From 53ce5e378ace1d94dedeba0d84c353fbb3b59433 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Mon, 5 May 2025 12:10:25 -0500 Subject: T7417: check existence of path before set_tag The migration script assumed the existence of path ['vrf', 'name', tag-val-name, 'protocols', 'static', 'route'] ignoring sole entries for [..., 'route6']. Check existence of each path before calling set_tag. --- src/migration-scripts/vrf/1-to-2 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/migration-scripts') diff --git a/src/migration-scripts/vrf/1-to-2 b/src/migration-scripts/vrf/1-to-2 index 557a9ec58..89b0f708a 100644 --- a/src/migration-scripts/vrf/1-to-2 +++ b/src/migration-scripts/vrf/1-to-2 @@ -37,7 +37,10 @@ def migrate(config: ConfigTree) -> None: new_static_base = vrf_base + [vrf, 'protocols'] config.set(new_static_base) config.copy(static_base, new_static_base + ['static']) - config.set_tag(new_static_base + ['static', 'route']) + if config.exists(new_static_base + ['static', 'route']): + config.set_tag(new_static_base + ['static', 'route']) + if config.exists(new_static_base + ['static', 'route6']): + config.set_tag(new_static_base + ['static', 'route6']) # Now delete the old configuration config.delete(base) -- cgit v1.2.3