summaryrefslogtreecommitdiff
path: root/src/migration-scripts/nat/6-to-7
diff options
context:
space:
mode:
authorNicolas Fort <nicolasfort1988@gmail.com>2024-07-03 09:53:56 -0300
committerChristian Breunig <christian@breunig.cc>2024-07-03 21:17:47 +0200
commitd38c917949018feae464bcee6b097c0d02fdc7ed (patch)
tree31d637ce6cbab1ed5048b7a10655d548485d789f /src/migration-scripts/nat/6-to-7
parent272a1b25515405f48a97908ccc5c04295cf3b92c (diff)
downloadvyos-1x-d38c917949018feae464bcee6b097c0d02fdc7ed.tar.gz
vyos-1x-d38c917949018feae464bcee6b097c0d02fdc7ed.zip
T6536: change wildcard character from + to * - extend fix to interfaces defined in zone policy.
(cherry picked from commit 66ec278393dbabe71f320c543816f27797d51140)
Diffstat (limited to 'src/migration-scripts/nat/6-to-7')
-rwxr-xr-xsrc/migration-scripts/nat/6-to-718
1 files changed, 2 insertions, 16 deletions
diff --git a/src/migration-scripts/nat/6-to-7 b/src/migration-scripts/nat/6-to-7
index 54968f52f..25640dec2 100755
--- a/src/migration-scripts/nat/6-to-7
+++ b/src/migration-scripts/nat/6-to-7
@@ -35,7 +35,6 @@ file_name = argv[1]
with open(file_name, 'r') as f:
config_file = f.read()
-<<<<<<< HEAD
config = ConfigTree(config_file)
if not config.exists(['nat']):
@@ -60,6 +59,8 @@ for direction in ['source', 'destination']:
tmp = config.return_value(base + [iface, 'interface-name'])
if tmp != 'any':
config.delete(base + [iface, 'interface-name'])
+ if '+' in tmp:
+ tmp = tmp.replace('+', '*')
config.set(base + [iface, 'name'], value=tmp)
else:
config.delete(base + [iface])
@@ -70,18 +71,3 @@ try:
except OSError as e:
print("Failed to save the modified config: {}".format(e))
exit(1)
-=======
- for rule in config.list_nodes(['nat', direction, 'rule']):
- base = ['nat', direction, 'rule', rule]
- for iface in ['inbound-interface','outbound-interface']:
- if config.exists(base + [iface]):
- if config.exists(base + [iface, 'interface-name']):
- tmp = config.return_value(base + [iface, 'interface-name'])
- if tmp != 'any':
- config.delete(base + [iface, 'interface-name'])
- if '+' in tmp:
- tmp = tmp.replace('+', '*')
- config.set(base + [iface, 'name'], value=tmp)
- else:
- config.delete(base + [iface])
->>>>>>> 148af29b6 (T6536: nat: add migration script that replaces wildcard charater supported in 1.3 <+> with character supported in latest version <*>)