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

externalize workflow step

parent 9a5789af
No related branches found
No related tags found
1 merge request!211Feature/add sharepoint service
...@@ -3,9 +3,14 @@ ...@@ -3,9 +3,14 @@
import json import json
from typing import Any from typing import Any
from orchestrator import step from orchestrator import inputstep, step
from orchestrator.config.assignee import Assignee
from orchestrator.types import State, UUIDstr from orchestrator.types import State, UUIDstr
from orchestrator.utils.json import json_dumps from orchestrator.utils.json import json_dumps
from pydantic import ConfigDict
from pydantic_forms.core import FormPage
from pydantic_forms.types import FormGenerator
from pydantic_forms.validators import Label
from gso.products.product_types.iptrunk import Iptrunk from gso.products.product_types.iptrunk import Iptrunk
from gso.services.lso_client import execute_playbook from gso.services.lso_client import execute_playbook
...@@ -101,3 +106,18 @@ def run_checks_after_base_config(subscription: dict[str, Any], callback_route: s ...@@ -101,3 +106,18 @@ def run_checks_after_base_config(subscription: dict[str, Any], callback_route: s
inventory=subscription["router"]["router_fqdn"], inventory=subscription["router"]["router_fqdn"],
extra_vars={"wfo_router_json": subscription}, extra_vars={"wfo_router_json": subscription},
) )
@inputstep("Prompt for new SharePoint checklist", assignee=Assignee.SYSTEM)
def prompt_sharepoint_checklist_url(checklist_url: str) -> FormGenerator:
"""Prompt the operator with the checklist in SharePoint for approving this new router."""
class SharepointPrompt(FormPage):
model_config = ConfigDict(title="Complete new checklist")
info_label_1: Label = f"A new checklist has been created at: {checklist_url}"
info_label_2: Label = "Click proceed to finish the workflow."
yield SharepointPrompt
return {}
...@@ -23,7 +23,12 @@ from gso.services.partners import get_partner_by_name ...@@ -23,7 +23,12 @@ from gso.services.partners import get_partner_by_name
from gso.services.sharepoint import SharePointClient from gso.services.sharepoint import SharePointClient
from gso.utils.helpers import generate_fqdn, iso_from_ipv4 from gso.utils.helpers import generate_fqdn, iso_from_ipv4
from gso.utils.shared_enums import PortNumber, Vendor from gso.utils.shared_enums import PortNumber, Vendor
from gso.utils.workflow_steps import deploy_base_config_dry, deploy_base_config_real, run_checks_after_base_config from gso.utils.workflow_steps import (
deploy_base_config_dry,
deploy_base_config_real,
prompt_sharepoint_checklist_url,
run_checks_after_base_config,
)
def _site_selector() -> Choice: def _site_selector() -> Choice:
...@@ -228,21 +233,6 @@ def create_new_sharepoint_checklist(subscription: RouterProvisioning, tt_number: ...@@ -228,21 +233,6 @@ def create_new_sharepoint_checklist(subscription: RouterProvisioning, tt_number:
return {"checklist_url": new_list_item_url} return {"checklist_url": new_list_item_url}
@inputstep("Prompt for new Sharepoint checklist", assignee=Assignee.SYSTEM)
def prompt_sharepoint_checklist_url(checklist_url: str) -> FormGenerator:
"""Prompt the operator with the checklist in SharePoint for approving this new router."""
class SharepointPrompt(FormPage):
model_config = ConfigDict(title="Complete new checklist")
info_label_1: Label = f"A new checklist has been created at: {checklist_url}"
info_label_2: Label = "Click proceed to finish the workflow."
yield SharepointPrompt
return {}
@workflow( @workflow(
"Create router", "Create router",
initial_input_form=wrap_create_initial_input_form(initial_input_form_generator), initial_input_form=wrap_create_initial_input_form(initial_input_form_generator),
......
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