From b8fbffb2b2559f7981182aa9527779df5e1532e7 Mon Sep 17 00:00:00 2001 From: Karel van Klink <karel.vanklink@geant.org> Date: Fri, 2 Feb 2024 13:46:09 +0100 Subject: [PATCH] Add code comments to trunk migration logic --- .pre-commit-config.yaml | 1 + gso/workflows/iptrunk/migrate_iptrunk.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b6911b2d..70bfc27e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,6 +8,7 @@ repos: args: - --fix - --preview + - --ignore=PLR0917,PLR0914 # Run the formatter. - id: ruff-format args: diff --git a/gso/workflows/iptrunk/migrate_iptrunk.py b/gso/workflows/iptrunk/migrate_iptrunk.py index 0f47dfee..810041cd 100644 --- a/gso/workflows/iptrunk/migrate_iptrunk.py +++ b/gso/workflows/iptrunk/migrate_iptrunk.py @@ -7,7 +7,6 @@ configured to run from A to C. B is then no longer associated with this IP trunk import copy import json import re -from typing import NoReturn from uuid import uuid4 from orchestrator import step, workflow @@ -88,7 +87,9 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator: not migrate_form_input.migrate_to_different_site and current_router_site.subscription_id != old_side_site.owner_subscription_id ): + # We want to stay on the same site, so all routers that are in different sites get skipped. continue + # If migrate_to_different_site is true, we can add ALL routers to the result map routers[str(router_id)] = router["description"] new_router_enum = Choice("Select a new router", zip(routers.keys(), routers.items(), strict=True)) # type: ignore[arg-type] @@ -148,7 +149,7 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator: new_lag_member_interfaces: ae_members # type: ignore[valid-type] @validator("new_lag_interface", allow_reuse=True, pre=True, always=True) - def lag_interface_proper_name(cls, new_lag_interface: str) -> str | NoReturn: + def lag_interface_proper_name(cls, new_lag_interface: str) -> str: if get_router_vendor(new_router) == RouterVendor.JUNIPER: juniper_lag_re = re.compile("^ae\\d{1,2}$") if not juniper_lag_re.match(new_lag_interface): -- GitLab