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

split off duplicate code to helper method

parent b7cc4094
No related branches found
No related tags found
1 merge request!131Move provisioning proxy steps to the new LSO endpoint
......@@ -11,19 +11,19 @@ from gso.products.product_types.iptrunk import Iptrunk
from gso.services.provisioning_proxy import execute_playbook
@step("[DRY RUN] Deploy base config")
def deploy_base_config_dry(
def _deploy_base_config(
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."""
*,
dry_run: bool,
) -> None:
inventory = subscription["router"]["router_fqdn"]
extra_vars = {
"wfo_router_json": subscription,
"dry_run": True,
"dry_run": dry_run,
"verb": "deploy",
"commit_comment": f"GSO_PROCESS_ID: {process_id} - TT_NUMBER: {tt_number} - Deploy base config",
}
......@@ -35,6 +35,17 @@ def deploy_base_config_dry(
extra_vars=extra_vars,
)
@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."""
_deploy_base_config(subscription, tt_number, callback_route, process_id, dry_run=True)
return {"subscription": subscription}
......@@ -46,21 +57,7 @@ def deploy_base_config_real(
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,
)
_deploy_base_config(subscription, tt_number, callback_route, process_id, dry_run=False)
return {"subscription": subscription}
......
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