Skip to content
Snippets Groups Projects
Verified Commit 10cd77c4 authored by Karel van Klink's avatar Karel van Klink :smiley_cat:
Browse files

Put LSO interactions inside a step group to reduce GUI clutter

parent 9ea08606
No related branches found
No related tags found
No related merge requests found
Pipeline #89211 failed
This commit is part of merge request !267. Comments created here will be created in the context of that merge request.
...@@ -12,7 +12,7 @@ from orchestrator import step ...@@ -12,7 +12,7 @@ from orchestrator import step
from orchestrator.config.assignee import Assignee from orchestrator.config.assignee import Assignee
from orchestrator.types import State from orchestrator.types import State
from orchestrator.utils.errors import ProcessFailureError from orchestrator.utils.errors import ProcessFailureError
from orchestrator.workflow import Step, StepList, begin, callback_step, inputstep from orchestrator.workflow import Step, begin, callback_step, inputstep, step_group
from pydantic import ConfigDict from pydantic import ConfigDict
from pydantic_forms.core import FormPage from pydantic_forms.core import FormPage
from pydantic_forms.types import FormGenerator from pydantic_forms.types import FormGenerator
...@@ -144,7 +144,7 @@ def _clean_state() -> State: ...@@ -144,7 +144,7 @@ def _clean_state() -> State:
return {"__remove_keys": ["run_results", "lso_result_title", "lso_result_extra_label", "callback_result"]} return {"__remove_keys": ["run_results", "lso_result_title", "lso_result_extra_label", "callback_result"]}
def lso_interaction(provisioning_step: Step) -> StepList: def lso_interaction(provisioning_step: Step) -> Step:
"""Interact with the provisioning proxy :term:`LSO` using a callback step. """Interact with the provisioning proxy :term:`LSO` using a callback step.
An asynchronous interaction with the provisioning proxy. This is an external system that executes Ansible playbooks An asynchronous interaction with the provisioning proxy. This is an external system that executes Ansible playbooks
...@@ -157,19 +157,20 @@ def lso_interaction(provisioning_step: Step) -> StepList: ...@@ -157,19 +157,20 @@ def lso_interaction(provisioning_step: Step) -> StepList:
:param provisioning_step: A workflow step that performs an operation remotely using the provisioning proxy. :param provisioning_step: A workflow step that performs an operation remotely using the provisioning proxy.
:type provisioning_step: :class:`Step` :type provisioning_step: :class:`Step`
:return: A list of steps that is executed as part of the workflow. :return: A step group that is executed as part of the workflow.
:rtype: :class:`StepList` :rtype: :class:`Step`
""" """
return ( return step_group(
begin name=provisioning_step.name,
steps=begin
>> callback_step(name=provisioning_step.name, action_step=provisioning_step, validate_step=_evaluate_results) >> 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}) >> step("Inject result title")(lambda: {"lso_result_title": provisioning_step.name})
>> _show_results >> _show_results
>> _clean_state >> _clean_state,
) )
def indifferent_lso_interaction(provisioning_step: Step) -> StepList: def indifferent_lso_interaction(provisioning_step: Step) -> Step:
"""Interact with the provisioning proxy :term:`LSO` using a callback step. """Interact with the provisioning proxy :term:`LSO` using a callback step.
This interaction is identical from the one described in ``lso_interaction()``, with one functional difference. This interaction is identical from the one described in ``lso_interaction()``, with one functional difference.
...@@ -182,19 +183,20 @@ def indifferent_lso_interaction(provisioning_step: Step) -> StepList: ...@@ -182,19 +183,20 @@ def indifferent_lso_interaction(provisioning_step: Step) -> StepList:
:param provisioning_step: A workflow step that performs an operation remotely using the provisioning proxy. :param provisioning_step: A workflow step that performs an operation remotely using the provisioning proxy.
:type provisioning_step: :class:`Step` :type provisioning_step: :class:`Step`
:return: A list of steps that is executed as part of the workflow. :return: A step group that is executed as part of the workflow.
:rtype: :class:`StepList` :rtype: :class:`Step`
""" """
return ( return step_group(
begin name=provisioning_step.name,
steps=begin
>> callback_step(name=provisioning_step.name, action_step=provisioning_step, validate_step=_ignore_results) >> 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}) >> step("Inject result title")(lambda: {"lso_result_title": provisioning_step.name})
>> _show_results >> _show_results
>> _clean_state >> _clean_state,
) )
def anonymous_lso_interaction(provisioning_step: Step, validation_step: Step = _evaluate_results) -> StepList: def anonymous_lso_interaction(provisioning_step: Step, validation_step: Step = _evaluate_results) -> Step:
"""Interact with the provisioning proxy :term:`LSO` without any user input. """Interact with the provisioning proxy :term:`LSO` without any user input.
Similar to the indifferent :term:`LSO` interaction, there also is the anonymous interaction. Output is not ignored Similar to the indifferent :term:`LSO` interaction, there also is the anonymous interaction. Output is not ignored
...@@ -205,8 +207,9 @@ def anonymous_lso_interaction(provisioning_step: Step, validation_step: Step = _ ...@@ -205,8 +207,9 @@ def anonymous_lso_interaction(provisioning_step: Step, validation_step: Step = _
:param Step provisioning_step: A workflow step to remotely provision a subscription. :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 evaluates the return code. :param Step validation_step: An optional validation step which defaults to a step that evaluates the return code.
""" """
return ( return step_group(
begin name=provisioning_step.name,
steps=begin
>> callback_step(name=provisioning_step.name, action_step=provisioning_step, validate_step=validation_step) >> callback_step(name=provisioning_step.name, action_step=provisioning_step, validate_step=validation_step)
>> _clean_state >> _clean_state,
) )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment