Skip to content
Snippets Groups Projects
Commit ce6d11e4 authored by Karel van Klink's avatar Karel van Klink :smiley_cat: Committed by Neda Moeini
Browse files

extend the LSO client with an interaction that does not include an input step

parent aad42eca
No related branches found
No related tags found
1 merge request!139Feature/add validation workflows
......@@ -134,10 +134,14 @@ def _show_results(state: State) -> FormGenerator:
run_results: ReadOnlyField(json.dumps(state["callback_result"], indent=4), default_type=LongText) # type: ignore[valid-type]
yield ConfirmRunPage
[state.pop(key, None) for key in ["run_results", "lso_result_title", "lso_result_extra_label"]]
return state
@step("Clean up keys from state")
def _clean_state() -> State:
return {"__remove_keys": ["run_results", "lso_result_title", "lso_result_extra_label", "callback_result"]}
def lso_interaction(provisioning_step: Step) -> StepList:
"""Interact with the provisioning proxy :term:`LSO` using a callback step.
......@@ -159,6 +163,7 @@ def lso_interaction(provisioning_step: Step) -> StepList:
>> callback_step(name=provisioning_step.name, action_step=provisioning_step, validate_step=_evaluate_results)
>> step("Inject result title")(lambda: {"lso_result_title": provisioning_step.name})
>> _show_results
>> _clean_state
)
......@@ -183,4 +188,23 @@ def indifferent_lso_interaction(provisioning_step: Step) -> StepList:
>> callback_step(name=provisioning_step.name, action_step=provisioning_step, validate_step=_ignore_results)
>> step("Inject result title")(lambda: {"lso_result_title": provisioning_step.name})
>> _show_results
>> _clean_state
)
def anonymous_lso_interaction(provisioning_step: Step, validation_step: Step = _ignore_results) -> StepList:
"""Interact with the provisioning proxy :term:`LSO` without any user input.
Going one step further than the indifferent :term:`LSO` interaction, is the anonymous interaction. Output is ignored
and no input step is created to display the results.
A custom validation step may be given as input. This validation step should look inside the ``callback_result`` key
in the current state.
:param Step provisioning_step: A workflow step to remotely provision a subscription.
:param Step validation_step: An optional validation step which defaults to a step that ignores the results.
"""
return (
begin
>> callback_step(name=provisioning_step.name, action_step=provisioning_step, validate_step=validation_step)
>> _clean_state
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment