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

Put repeated strings in reusable constants

parent c4cb5fc5
No related branches found
No related tags found
1 merge request!330Feature/sonarqube improvements
......@@ -53,6 +53,7 @@ from gso.utils.types.ip_address import (
from gso.utils.types.virtual_identifiers import VC_ID, VLAN_ID
app: typer.Typer = typer.Typer()
IMPORT_WAIT_MESSAGE = "Waiting for the dust to settle before importing new products..."
class CreatePartner(BaseModel):
......@@ -451,7 +452,7 @@ def _generic_import_product(
except ValidationError as e:
typer.echo(f"Validation error: {e}")
typer.echo("Waiting for the dust to settle before moving on the importing new products...")
typer.echo(IMPORT_WAIT_MESSAGE)
time.sleep(1)
# Migrate new products from imported to "full" counterpart.
......@@ -539,7 +540,7 @@ def import_edge_port(filepath: str = common_filepath_option) -> None:
except ValidationError as e:
typer.echo(f"Validation error: {e}")
typer.echo("Waiting for the dust to settle before moving on the importing new products...")
typer.echo(IMPORT_WAIT_MESSAGE)
time.sleep(1)
edge_port_ids = get_subscriptions(
......@@ -610,7 +611,7 @@ def import_iptrunks(filepath: str = common_filepath_option) -> None:
except ValidationError as e:
typer.echo(f"Validation error: {e}")
typer.echo("Waiting for the dust to settle before moving on the importing new products...")
typer.echo(IMPORT_WAIT_MESSAGE)
time.sleep(1)
trunk_ids = get_subscriptions(
......@@ -670,7 +671,7 @@ def import_l3_core_service(filepath: str = common_filepath_option) -> None:
except ValidationError as e:
typer.echo(f"Validation error: {e}")
typer.echo("Waiting for the dust to settle before importing new products...")
typer.echo(IMPORT_WAIT_MESSAGE)
time.sleep(1)
# Migrate new products from imported to "full" counterpart.
......@@ -728,7 +729,7 @@ def import_layer_2_circuit_service(filepath: str = common_filepath_option) -> No
)
except ValidationError as e:
typer.echo(f"Validation error: {e}")
typer.echo("Waiting for the dust to settle before importing new products...")
typer.echo(IMPORT_WAIT_MESSAGE)
time.sleep(1)
# Migrate new products from imported to "full" counterpart.
......
......@@ -22,6 +22,7 @@ from unidecode import unidecode
from gso import settings
logger = logging.getLogger(__name__)
RUNNING_ANSIBLE_PLAYBOOK_STEP_NAME = "Running Ansible playbook"
class _LSOState(TypedDict): # noqa: PYI049
......@@ -211,7 +212,7 @@ def lso_interaction(provisioning_step: Step) -> StepList:
>> _inventory_is_not_empty(
begin
>> callback_step(
name="Running Ansible playbook", action_step=_execute_playbook, validate_step=_evaluate_results
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
......@@ -243,7 +244,7 @@ def indifferent_lso_interaction(provisioning_step: Step) -> StepList:
>> _inventory_is_not_empty(
begin
>> callback_step(
name="Running Ansible playbook", action_step=_execute_playbook, validate_step=_ignore_results
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
......@@ -268,7 +269,9 @@ def anonymous_lso_interaction(provisioning_step: Step, validation_step: Step = _
begin
>> provisioning_step
>> _inventory_is_not_empty(
callback_step(name="Running Ansible playbook", action_step=_execute_playbook, validate_step=validation_step)
callback_step(
name=RUNNING_ANSIBLE_PLAYBOOK_STEP_NAME, action_step=_execute_playbook, validate_step=validation_step
)
)
>> _clean_state
)
......@@ -287,7 +290,7 @@ def anonymous_indifferent_lso_interaction(provisioning_step: Step) -> StepList:
>> provisioning_step
>> _inventory_is_not_empty(
callback_step(
name="Running Ansible playbook",
name=RUNNING_ANSIBLE_PLAYBOOK_STEP_NAME,
action_step=_execute_playbook,
validate_step=_ignore_results,
)
......
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