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

Method put

st2api/st2api/controllers/v1/pack_configs.py:113–134  ·  view source on GitHub ↗

Create a new config for a pack. Handles requests: POST /configs/

(self, pack_config_content, pack_ref, requester_user, show_secrets=False)

Source from the content-addressed store, hash-verified

111 )
112
113 def put(self, pack_config_content, pack_ref, requester_user, show_secrets=False):
114 """
115 Create a new config for a pack.
116
117 Handles requests:
118 POST /configs/<pack_ref>
119 """
120
121 try:
122 config_api = ConfigAPI(pack=pack_ref, values=vars(pack_config_content))
123 config_api.validate(validate_against_schema=True)
124 except jsonschema.ValidationError as e:
125 raise ValueValidationException(six.text_type(e))
126 except ValueValidationException as e:
127 raise ValueValidationException(six.text_type(e))
128
129 self._dump_config_to_disk(config_api)
130
131 config_db = ConfigsRegistrar.save_model(config_api)
132
133 mask_secrets = self._get_mask_secrets(requester_user, show_secrets=show_secrets)
134 return ConfigAPI.from_model(config_db, mask_secrets=mask_secrets)
135
136 def _dump_config_to_disk(self, config_api):
137 config_content = yaml.safe_dump(config_api.values, default_flow_style=False)

Callers

nothing calls this directly

Calls 7

validateMethod · 0.95
_dump_config_to_diskMethod · 0.95
ConfigAPIClass · 0.90
save_modelMethod · 0.80
_get_mask_secretsMethod · 0.80
from_modelMethod · 0.45

Tested by

no test coverage detected