diff options
author | Nicolas Fort <nicolasfort1988@gmail.com> | 2023-12-11 10:08:59 +0000 |
---|---|---|
committer | Mergify <37929162+mergify[bot]@users.noreply.github.com> | 2023-12-21 11:24:27 +0000 |
commit | 41fdbae4e5bbfaf9f7539b93a78a851981037cd8 (patch) | |
tree | 1157e69223746af5fe4af98b26df2f00fdb630d4 /src/migration-scripts/nat | |
parent | a5a5658acde0ebb8b6866f6f0feaadaab938bd0a (diff) | |
download | vyos-1x-41fdbae4e5bbfaf9f7539b93a78a851981037cd8.tar.gz vyos-1x-41fdbae4e5bbfaf9f7539b93a78a851981037cd8.zip |
T5804: nat: remove inbound|outbound interface from old configuration when it was set to <any>.
(cherry picked from commit 5cb95aed965b45a900c6ba97c0bccefed83332b6)
Diffstat (limited to 'src/migration-scripts/nat')
-rwxr-xr-x | src/migration-scripts/nat/6-to-7 | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/migration-scripts/nat/6-to-7 b/src/migration-scripts/nat/6-to-7 index b5f6328ef..a2e735394 100755 --- a/src/migration-scripts/nat/6-to-7 +++ b/src/migration-scripts/nat/6-to-7 @@ -21,6 +21,7 @@ # to # 'set nat [source|destination] rule X [inbound-interface|outbound interface] name <iface>' # 'set nat [source|destination] rule X [inbound-interface|outbound interface] group <iface_group>' +# Also remove command if interface == any from sys import argv,exit from vyos.configtree import ConfigTree @@ -56,8 +57,11 @@ for direction in ['source', 'destination']: if config.exists(base + [iface]): if config.exists(base + [iface, 'interface-name']): tmp = config.return_value(base + [iface, 'interface-name']) - config.delete(base + [iface, 'interface-name']) - config.set(base + [iface, 'name'], value=tmp) + if tmp != 'any': + config.delete(base + [iface, 'interface-name']) + config.set(base + [iface, 'name'], value=tmp) + else: + config.delete(base + [iface]) try: with open(file_name, 'w') as f: |