diff options
author | Nicolas Fort <nicolasfort1988@gmail.com> | 2024-07-02 08:54:11 -0300 |
---|---|---|
committer | Mergify <37929162+mergify[bot]@users.noreply.github.com> | 2024-07-03 14:33:55 +0000 |
commit | 272a1b25515405f48a97908ccc5c04295cf3b92c (patch) | |
tree | c04574b597975262b783c423800cf95bca2a0ee4 /src | |
parent | 3817a83f0af6f7a97e1fb822d0e5da844068100f (diff) | |
download | vyos-1x-272a1b25515405f48a97908ccc5c04295cf3b92c.tar.gz vyos-1x-272a1b25515405f48a97908ccc5c04295cf3b92c.zip |
T6536: nat: add migration script that replaces wildcard charater supported in 1.3 <+> with character supported in latest version <*>
(cherry picked from commit 148af29b68416a5b8d0e025a16aef252fdf31e67)
# Conflicts:
# src/migration-scripts/nat/6-to-7
Diffstat (limited to 'src')
-rwxr-xr-x | src/migration-scripts/nat/6-to-7 | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/migration-scripts/nat/6-to-7 b/src/migration-scripts/nat/6-to-7 index a2e735394..54968f52f 100755 --- a/src/migration-scripts/nat/6-to-7 +++ b/src/migration-scripts/nat/6-to-7 @@ -35,6 +35,7 @@ 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']): @@ -69,3 +70,18 @@ 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 <*>) |