Skip to content

Commit

Permalink
Merge pull request #2611 from nicolas-fort/T5804-mig-script
Browse files Browse the repository at this point in the history
T5804: nat: remove inbound|outbound interface from old configuration when it was set to <any>.
  • Loading branch information
dmbaturin authored Dec 12, 2023
2 parents 138fe52 + 5cb95ae commit a2b9477
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 a2b9477

Please sign in to comment.