summaryrefslogtreecommitdiff
path: root/src/migration-scripts/policy/1-to-2
diff options
context:
space:
mode:
authorNicolas Fort <nicolasfort1988@gmail.com>2024-03-15 21:35:57 +0000
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2024-03-16 08:47:06 +0000
commit4413e5b633c616f9bc16d9e09d0551dfe9ae2ab1 (patch)
tree2ea2083c54e6337e1a5179b577ab4b2596d5d61e /src/migration-scripts/policy/1-to-2
parenta0b2b259484d5602f1faa0fbb6e60cd0e0b58a35 (diff)
downloadvyos-1x-4413e5b633c616f9bc16d9e09d0551dfe9ae2ab1.tar.gz
vyos-1x-4413e5b633c616f9bc16d9e09d0551dfe9ae2ab1.zip
T6090: fix policy route migration script. Ensure that tcp flags migration occurs also if only <policy route> is defined.
(cherry picked from commit 1048f49e403d7ce3df379bbf48e7fcc60a74e67b)
Diffstat (limited to 'src/migration-scripts/policy/1-to-2')
-rwxr-xr-xsrc/migration-scripts/policy/1-to-218
1 files changed, 9 insertions, 9 deletions
diff --git a/src/migration-scripts/policy/1-to-2 b/src/migration-scripts/policy/1-to-2
index c70490ce9..c7a983bba 100755
--- a/src/migration-scripts/policy/1-to-2
+++ b/src/migration-scripts/policy/1-to-2
@@ -32,23 +32,23 @@ file_name = argv[1]
with open(file_name, 'r') as f:
config_file = f.read()
-base = ['policy', 'ipv6-route']
+base = ['policy']
config = ConfigTree(config_file)
if not config.exists(base):
# Nothing to do
exit(0)
-config.rename(base, 'route6')
-config.set_tag(['policy', 'route6'])
+if config.exists(base + ['ipv6-route']):
+ config.rename(base + ['ipv6-route'],'route6')
+ config.set_tag(['policy', 'route6'])
for route in ['route', 'route6']:
- route_path = ['policy', route]
- if config.exists(route_path):
- for name in config.list_nodes(route_path):
- if config.exists(route_path + [name, 'rule']):
- for rule in config.list_nodes(route_path + [name, 'rule']):
- rule_tcp_flags = route_path + [name, 'rule', rule, 'tcp', 'flags']
+ if config.exists(base + [route]):
+ for name in config.list_nodes(base + [route]):
+ if config.exists(base + [route, name, 'rule']):
+ for rule in config.list_nodes(base + [route, name, 'rule']):
+ rule_tcp_flags = base + [route, name, 'rule', rule, 'tcp', 'flags']
if config.exists(rule_tcp_flags):
tmp = config.return_value(rule_tcp_flags)