Skip to content

Commit

Permalink
T5804: nat: remove inbound|outbound interface from old configuration …
Browse files Browse the repository at this point in the history
…when it was set to <any>.
  • Loading branch information
nicolas-fort committed Dec 11, 2023
1 parent fedb2ee commit 5cb95ae
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/migration-scripts/nat/6-to-7
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 5cb95ae

Please sign in to comment.