Skip to content
Snippets Groups Projects

Make use of new callback step for external provisioning

Merged Karel van Klink requested to merge feature/use-async-steps into develop
All threads resolved!
1 file
+ 22
2
Compare changes
  • Side-by-side
  • Inline
@@ -7,10 +7,14 @@ import logging
import requests
from orchestrator import step
from orchestrator.config.assignee import Assignee
from orchestrator.types import State, UUIDstr, strEnum
from orchestrator.utils.errors import ProcessFailureError
from orchestrator.utils.json import json_dumps
from orchestrator.workflow import Step, callback_step, begin, StepList
from orchestrator.workflow import Step, callback_step, begin, StepList, inputstep
from pydantic_forms.core import FormPage, ReadOnlyField
from pydantic_forms.types import FormGenerator
from pydantic_forms.validators import LongText
from gso import settings
from gso.products.product_types.iptrunk import Iptrunk, IptrunkProvisioning
@@ -268,7 +272,23 @@ def _clean_up_state(state: State) -> State:
return state
@inputstep("Confirm provisioning proxy results", assignee=Assignee("SYSTEM"))
def _show_pp_results(state: State) -> FormGenerator:
if "callback_result" not in state:
return state
class ConfirmRunPage(FormPage):
class Config:
title: str = f"Execution for {state['subscription']['product']['name']} completed."
run_status: str = ReadOnlyField(state["callback_result"]["status"])
run_results: LongText = ReadOnlyField(json.dumps(state["callback_result"]["output"], indent=4))
yield ConfirmRunPage
return state
def pp_interaction(provisioning_step: Step, interaction_name: str) -> StepList:
return begin >> callback_step(
name=interaction_name, action_step=provisioning_step, validate_step=_evaluate_pp_results
) >> _clean_up_state
) >> _show_pp_results >> _clean_up_state
Loading