MCPcopy Index your code
hub / github.com/StackStorm/st2 / run_and_print

Method run_and_print

st2client/st2client/commands/pack.py:343–379  ·  view source on GitHub ↗
(self, args, **kwargs)

Source from the content-addressed store, hash-verified

341
342 @add_auth_token_to_kwargs_from_cli
343 def run_and_print(self, args, **kwargs):
344 instance = super(PackInstallCommand, self).run_and_print(args, **kwargs)
345 # Hack to get a list of resolved references of installed packs
346 packs = instance.result["output"]["packs_list"]
347
348 if len(packs) == 1:
349 pack_instance = self.app.client.managers["Pack"].get_by_ref_or_id(
350 packs[0], **kwargs
351 )
352 self.print_output(
353 pack_instance,
354 table.PropertyValueTable,
355 attributes=args.attr,
356 json=args.json,
357 yaml=args.yaml,
358 attribute_display_order=self.attribute_display_order,
359 )
360 else:
361 all_pack_instances = self.app.client.managers["Pack"].get_all(**kwargs)
362 pack_instances = []
363
364 for pack in all_pack_instances:
365 if pack.name in packs or pack.ref in packs:
366 pack_instances.append(pack)
367
368 self.print_output(
369 pack_instances,
370 table.MultiColumnTable,
371 attributes=args.attr,
372 widths=args.width,
373 json=args.json,
374 yaml=args.yaml,
375 )
376
377 warnings = instance.result["output"]["warning_list"]
378 for warning in warnings:
379 print(warning)
380
381
382class PackRemoveCommand(PackAsyncCommand):

Callers

nothing calls this directly

Calls 4

get_by_ref_or_idMethod · 0.80
print_outputMethod · 0.80
run_and_printMethod · 0.45
get_allMethod · 0.45

Tested by

no test coverage detected