summaryrefslogtreecommitdiff
path: root/src/migration-scripts
diff options
context:
space:
mode:
Diffstat (limited to 'src/migration-scripts')
-rwxr-xr-xsrc/migration-scripts/dns-dynamic/2-to-331
1 files changed, 17 insertions, 14 deletions
diff --git a/src/migration-scripts/dns-dynamic/2-to-3 b/src/migration-scripts/dns-dynamic/2-to-3
index 02bc9324a..187c2a895 100755
--- a/src/migration-scripts/dns-dynamic/2-to-3
+++ b/src/migration-scripts/dns-dynamic/2-to-3
@@ -44,35 +44,38 @@ if not config.exists(address_path):
# Nothing to do
sys.exit(0)
-# config.copy does not recursively create a path, so initialize the name path
+# config.copy does not recursively create a path, so initialize the name path as tagged node
if not config.exists(name_path):
config.set(name_path)
+ config.set_tag(name_path)
for address in config.list_nodes(address_path):
+ address_path_tag = address_path + [address]
+
# Move web-option as a configuration in each service instead of top level web-option
- if config.exists(address_path + [address, 'web-options']) and address == 'web':
+ if config.exists(address_path_tag + ['web-options']) and address == 'web':
for svc_type in ['service', 'rfc2136']:
- if config.exists(address_path + [address, svc_type]):
- for svc_cfg in config.list_nodes(address_path + [address, svc_type]):
- config.copy(address_path + [address, 'web-options'],
- address_path + [address, svc_type, svc_cfg, 'web-options'])
- config.delete(address_path + [address, 'web-options'])
+ if config.exists(address_path_tag + [svc_type]):
+ for svc_cfg in config.list_nodes(address_path_tag + [svc_type]):
+ config.copy(address_path_tag + ['web-options'],
+ address_path_tag + [svc_type, svc_cfg, 'web-options'])
+ config.delete(address_path_tag + ['web-options'])
for svc_type in ['service', 'rfc2136']:
- if config.exists(address_path + [address, svc_type]):
+ if config.exists(address_path_tag + [svc_type]):
# Move RFC2136 as service configuration, rename to avoid name conflict and set protocol to 'nsupdate'
if svc_type == 'rfc2136':
- for rfc_cfg_old in config.list_nodes(address_path + [address, 'rfc2136']):
+ for rfc_cfg_old in config.list_nodes(address_path_tag + ['rfc2136']):
rfc_cfg_new = f'{rfc_cfg_old}-rfc2136'
- config.rename(address_path + [address, 'rfc2136', rfc_cfg_old], rfc_cfg_new)
- config.set(address_path + [address, 'rfc2136', rfc_cfg_new, 'protocol'], 'nsupdate')
+ config.rename(address_path_tag + ['rfc2136', rfc_cfg_old], rfc_cfg_new)
+ config.set(address_path_tag + ['rfc2136', rfc_cfg_new, 'protocol'], 'nsupdate')
# Add address as config value in each service before moving the service path
# And then copy the services from 'address <interface> service <service>' to 'name <service>'
- for svc_cfg in config.list_nodes(address_path + [address, svc_type]):
- config.set(address_path + [address, svc_type, svc_cfg, 'address'], address)
- config.copy(address_path + [address, svc_type, svc_cfg], name_path + [svc_cfg])
+ for svc_cfg in config.list_nodes(address_path_tag + [svc_type]):
+ config.set(address_path_tag + [svc_type, svc_cfg, 'address'], address)
+ config.copy(address_path_tag + [svc_type, svc_cfg], name_path + [svc_cfg])
# Finally cleanup the old address path
config.delete(address_path)