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

add module for shared workflow steps

parent 421fae12
No related branches found
No related tags found
No related merge requests found
"""Workflow steps that are shared across multiple workflows."""
from typing import Any
from orchestrator import step
from orchestrator.types import State, UUIDstr
from gso.services.provisioning_proxy import execute_playbook
@step("[DRY RUN] Deploy base config")
def deploy_base_config_dry(
subscription: dict[str, Any],
tt_number: str,
callback_route: str,
process_id: UUIDstr,
) -> State:
"""Perform a dry run of provisioning base config on a router."""
inventory = subscription["router"]["router_fqdn"]
extra_vars = {
"wfo_router_json": subscription,
"dry_run": True,
"verb": "deploy",
"commit_comment": f"GSO_PROCESS_ID: {process_id} - TT_NUMBER: {tt_number} - Deploy base config",
}
execute_playbook(
playbook_name="base_config.yaml",
callback_route=callback_route,
inventory=inventory,
extra_vars=extra_vars,
)
return {"subscription": subscription}
@step("[FOR REAL] Deploy base config")
def deploy_base_config_real(
subscription: dict[str, Any],
tt_number: str,
callback_route: str,
process_id: UUIDstr,
) -> State:
"""Deploy base config on a router using the provisioning proxy."""
inventory = subscription["router"]["router_fqdn"]
extra_vars = {
"wfo_router_json": subscription,
"dry_run": False,
"verb": "deploy",
"commit_comment": f"GSO_PROCESS_ID: {process_id} - TT_NUMBER: {tt_number} - Deploy base config",
}
execute_playbook(
playbook_name="base_config.yaml",
callback_route=callback_route,
inventory=inventory,
extra_vars=extra_vars,
)
return {"subscription": subscription}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment