diff --git a/gso/services/lso_client.py b/gso/services/lso_client.py index 77c2264798a009c79fb5a28dcd15a317e17b87c5..53add91b06c55c25f8ffc63551c6c0f92a77b5b7 100644 --- a/gso/services/lso_client.py +++ b/gso/services/lso_client.py @@ -12,7 +12,7 @@ from orchestrator import step from orchestrator.config.assignee import Assignee from orchestrator.types import State 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_forms.core import FormPage from pydantic_forms.types import FormGenerator @@ -144,7 +144,7 @@ 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: +def lso_interaction(provisioning_step: Step) -> 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 @@ -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. :type provisioning_step: :class:`Step` - :return: A list of steps that is executed as part of the workflow. - :rtype: :class:`StepList` + :return: A step group that is executed as part of the workflow. + :rtype: :class:`Step` """ - return ( - begin + return step_group( + name=provisioning_step.name, + steps=begin >> 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 + >> _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. 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: :param provisioning_step: A workflow step that performs an operation remotely using the provisioning proxy. :type provisioning_step: :class:`Step` - :return: A list of steps that is executed as part of the workflow. - :rtype: :class:`StepList` + :return: A step group that is executed as part of the workflow. + :rtype: :class:`Step` """ - return ( - begin + return step_group( + name=provisioning_step.name, + steps=begin >> 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 + >> _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. 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 = _ :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. """ - return ( - begin + return step_group( + name=provisioning_step.name, + steps=begin >> callback_step(name=provisioning_step.name, action_step=provisioning_step, validate_step=validation_step) - >> _clean_state + >> _clean_state, )