From 15c006548a7335be1d489d766888437f1c7dbde9 Mon Sep 17 00:00:00 2001
From: Aleksandr Kurbatov <aleksandr.kurbatov@GL1342-AKURBATOV.local>
Date: Tue, 27 Aug 2024 17:47:19 +0100
Subject: [PATCH] `promote_p_to_pe`: `add_pe_to_all_p`

inventory: need to exclude this router from inventory generator, because
at this point in WF it is still `P` role.
---
 gso/workflows/router/promote_p_to_pe.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/gso/workflows/router/promote_p_to_pe.py b/gso/workflows/router/promote_p_to_pe.py
index edd673d7..29a110c6 100644
--- a/gso/workflows/router/promote_p_to_pe.py
+++ b/gso/workflows/router/promote_p_to_pe.py
@@ -484,7 +484,7 @@ def add_all_p_to_pe_real(
     )
 
 
-@step("[DRY RUN] Add PE to all P")
+@step("[DRY RUN] Add this new PE to all P")
 def add_pe_to_all_p_dry(subscription: dict[str, Any], callback_route: str, tt_number: str, process_id: UUIDstr) -> None:
     """Perform a dry run of adding promoted router to all PE routers in iGEANT/iGEANT6."""
     extra_vars = {
@@ -498,12 +498,14 @@ def add_pe_to_all_p_dry(subscription: dict[str, Any], callback_route: str, tt_nu
     lso_client.execute_playbook(
         playbook_name="update_ibgp_mesh.yaml",
         callback_route=callback_route,
-        inventory=generate_inventory_for_active_routers(RouterRole.P),
+        inventory=generate_inventory_for_active_routers(
+            RouterRole.P, exclude_routers=[subscription["router"]["router_fqdn"]]
+        ),
         extra_vars=extra_vars,
     )
 
 
-@step("[FOR REAL] Add PE to all P")
+@step("[FOR REAL] Add this new PE to all P")
 def add_pe_to_all_p_real(
     subscription: dict[str, Any], callback_route: str, tt_number: str, process_id: UUIDstr
 ) -> None:
@@ -519,7 +521,9 @@ def add_pe_to_all_p_real(
     lso_client.execute_playbook(
         playbook_name="update_ibgp_mesh.yaml",
         callback_route=callback_route,
-        inventory=generate_inventory_for_active_routers(RouterRole.P),
+        inventory=generate_inventory_for_active_routers(
+            RouterRole.P, exclude_routers=[subscription["router"]["router_fqdn"]]
+        ),
         extra_vars=extra_vars,
     )
 
-- 
GitLab