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

Function render_live_params

st2common/st2common/util/param.py:305–346  ·  view source on GitHub ↗

Renders list of parameters. Ensures that there's no cyclic or missing dependencies. Returns a dict of plain rendered parameters.

(
    runner_parameters,
    action_parameters,
    params,
    action_context,
    additional_contexts=None,
)

Source from the content-addressed store, hash-verified

303
304
305def render_live_params(
306 runner_parameters,
307 action_parameters,
308 params,
309 action_context,
310 additional_contexts=None,
311):
312 """
313 Renders list of parameters. Ensures that there's no cyclic or missing dependencies. Returns a
314 dict of plain rendered parameters.
315 """
316 additional_contexts = additional_contexts or {}
317
318 pack = action_context.get("pack")
319 user = action_context.get("user")
320
321 try:
322 config = get_config(pack, user)
323 except Exception as e:
324 LOG.info(
325 "Failed to retrieve config for pack %s and user %s: %s"
326 % (pack, user, six.text_type(e))
327 )
328 config = {}
329
330 G = _create_graph(action_context, config)
331
332 # Additional contexts are applied after all other contexts (see _create_graph), but before any
333 # of the dependencies have been resolved.
334 for name, value in six.iteritems(additional_contexts):
335 G.add_node(name, value=value)
336
337 [_process(G, name, value) for name, value in six.iteritems(params)]
338 _process_defaults(G, [action_parameters, runner_parameters])
339 _validate(G)
340
341 context = _resolve_dependencies(G)
342 live_params = _cast_params_from(
343 params, context, [action_parameters, runner_parameters]
344 )
345
346 return live_params
347
348
349def render_final_params(runner_parameters, action_parameters, params, action_context):

Callers 1

get_finalized_paramsFunction · 0.85

Calls 8

get_configFunction · 0.90
_create_graphFunction · 0.85
_processFunction · 0.85
_process_defaultsFunction · 0.85
_validateFunction · 0.85
_resolve_dependenciesFunction · 0.85
_cast_params_fromFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected