diff --git a/gso/services/lso_client.py b/gso/services/lso_client.py index 8cfa6785a55d693283093ed80872a999908cf9b9..23c2ecf47b106b05d2eb48970460da2da9f47e91 100644 --- a/gso/services/lso_client.py +++ b/gso/services/lso_client.py @@ -15,7 +15,7 @@ from orchestrator.utils.errors import ProcessFailureError from orchestrator.workflow import Step, StepList, begin, callback_step, conditional, inputstep from pydantic import ConfigDict from pydantic_forms.types import FormGenerator, State, UUIDstr -from pydantic_forms.validators import Label, LongText, ReadOnlyField +from pydantic_forms.validators import Label, LongText from unidecode import unidecode from gso import settings @@ -146,13 +146,11 @@ def _show_results(state: State) -> FormGenerator: class ConfirmRunPage(SubmitFormPage): model_config = ConfigDict() - if "lso_result_extra_label" in state: - extra_label: Label = state["lso_result_extra_label"] - run_status: ReadOnlyField(state["callback_result"]["status"], default_type=str) # type: ignore[valid-type] - run_results: ReadOnlyField(json.dumps(state["callback_result"], indent=4), default_type=LongText) # type: ignore[valid-type] + run_status: Label = f"Callback result: {state["callback_result"]["status"]}" + run_results: LongText = json.dumps(state["callback_result"], indent=4) yield ConfirmRunPage - return state + return {} @step("Clean up keys from state") @@ -160,8 +158,6 @@ def _clean_state() -> State: return { "__remove_keys": [ "run_results", - "lso_result_title", - "lso_result_extra_label", "callback_result", "playbook_name", "callback_route", @@ -198,10 +194,6 @@ def lso_interaction(provisioning_step: Step) -> StepList: to provision service subscriptions. If the playbook fails, this step will also fail, allowing for the user to retry provisioning from the UI. - Optionally, the keys `lso_result_title` and `lso_result_extra_label` can be added to the state before running - this interaction. They will be used to customise the input step that shows the outcome of the LSO - interaction. - Args: provisioning_step: A workflow step that performs an operation remotely using the provisioning proxy. @@ -216,7 +208,6 @@ def lso_interaction(provisioning_step: Step) -> StepList: >> callback_step( name=RUNNING_ANSIBLE_PLAYBOOK_STEP_NAME, action_step=_execute_playbook, validate_step=_evaluate_results ) - >> step("Inject result title")(lambda: {"lso_result_title": provisioning_step.name}) >> _show_results ) >> _clean_state @@ -248,7 +239,6 @@ def indifferent_lso_interaction(provisioning_step: Step) -> StepList: >> callback_step( name=RUNNING_ANSIBLE_PLAYBOOK_STEP_NAME, action_step=_execute_playbook, validate_step=_ignore_results ) - >> step("Inject result title")(lambda: {"lso_result_title": provisioning_step.name}) >> _show_results ) >> _clean_state