MCPcopy Create free account
hub / github.com/StackStorm/st2 / run

Method run

st2client/st2client/commands/resource.py:580–595  ·  view source on GitHub ↗
(self, args, **kwargs)

Source from the content-addressed store, hash-verified

578
579 @add_auth_token_to_kwargs_from_cli
580 def run(self, args, **kwargs):
581 resource_id = getattr(args, self.pk_argument_name, None)
582 instance = self.get_resource(resource_id, **kwargs)
583 data = load_meta_file(args.file)
584 modified_instance = self.resource.deserialize(data)
585
586 if not getattr(modified_instance, "id", None):
587 modified_instance.id = instance.id
588 else:
589 if modified_instance.id != instance.id:
590 raise Exception(
591 "The value for the %s id in the JSON/YAML file "
592 "does not match the ID provided in the "
593 "command line arguments." % self.resource.get_display_name().lower()
594 )
595 return self.manager.update(modified_instance, **kwargs)
596
597 def run_and_print(self, args, **kwargs):
598 instance = self.run(args, **kwargs)

Callers 1

run_and_printMethod · 0.95

Calls 5

deserializeMethod · 0.80
get_display_nameMethod · 0.80
load_meta_fileFunction · 0.70
get_resourceMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected