diff options
author | sarthurdev <965089+sarthurdev@users.noreply.github.com> | 2022-09-05 14:43:08 +0200 |
---|---|---|
committer | sarthurdev <965089+sarthurdev@users.noreply.github.com> | 2022-09-13 11:59:12 +0200 |
commit | 30945f39d6d1f0fdba34ce1c2d887a1a6823ecbe (patch) | |
tree | ca9b4d04f2245870a44ee73592ee0e1d7b85c40d /src/migration-scripts/firewall/7-to-8 | |
parent | 24e5529be7b5a28868a666dabae0a1d61e6a5c15 (diff) | |
download | vyos-1x-30945f39d6d1f0fdba34ce1c2d887a1a6823ecbe.tar.gz vyos-1x-30945f39d6d1f0fdba34ce1c2d887a1a6823ecbe.zip |
zone-policy: T2199: Migrate zone-policy to firewall node
Diffstat (limited to 'src/migration-scripts/firewall/7-to-8')
-rwxr-xr-x | src/migration-scripts/firewall/7-to-8 | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/migration-scripts/firewall/7-to-8 b/src/migration-scripts/firewall/7-to-8 index 6929e20a5..ce527acf5 100755 --- a/src/migration-scripts/firewall/7-to-8 +++ b/src/migration-scripts/firewall/7-to-8 @@ -15,6 +15,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # T2199: Migrate interface firewall nodes to firewall interfaces <ifname> <direction> name/ipv6-name <name> +# T2199: Migrate zone-policy to firewall node import re @@ -34,9 +35,10 @@ with open(file_name, 'r') as f: config_file = f.read() base = ['firewall'] +zone_base = ['zone-policy'] config = ConfigTree(config_file) -if not config.exists(base): +if not config.exists(base) and not config.exists(zone_base): # Nothing to do exit(0) @@ -80,6 +82,14 @@ for iftype in config.list_nodes(['interfaces']): for vifc in config.list_nodes(['interfaces', iftype, ifname, 'vif-s', vifs, 'vif-c']): migrate_interface(config, iftype, ifname, vifs=vifs, vifc=vifc) +if config.exists(zone_base + ['zone']): + config.set(['firewall', 'zone']) + config.set_tag(['firewall', 'zone']) + + for zone in config.list_nodes(zone_base + ['zone']): + config.copy(zone_base + ['zone', zone], ['firewall', 'zone', zone]) + config.delete(zone_base) + try: with open(file_name, 'w') as f: f.write(config.to_string()) |