summaryrefslogtreecommitdiff
path: root/src/migration-scripts/pppoe-server/2-to-3
diff options
context:
space:
mode:
Diffstat (limited to 'src/migration-scripts/pppoe-server/2-to-3')
-rwxr-xr-xsrc/migration-scripts/pppoe-server/2-to-327
1 files changed, 21 insertions, 6 deletions
diff --git a/src/migration-scripts/pppoe-server/2-to-3 b/src/migration-scripts/pppoe-server/2-to-3
index 3f5415a94..d5d88d373 100755
--- a/src/migration-scripts/pppoe-server/2-to-3
+++ b/src/migration-scripts/pppoe-server/2-to-3
@@ -68,12 +68,27 @@ else:
config.delete(wins_base)
- # Remove RADIUS server req-limit node
- radius_base = base + ['authentication', 'radius']
- if config.exists(radius_base):
- for server in config.list_nodes(radius_base + ['server']):
- if config.exists(radius_base + ['server', server, 'req-limit']):
- config.delete(radius_base + ['server', server, 'req-limit'])
+ # Migrate radius-settings node to RADIUS and use this as base for the
+ # later migration of the RADIUS servers - this will save a lot of code
+ radius_settings = base + ['authentication', 'radius-settings']
+ if config.exists(radius_settings):
+ config.rename(radius_settings, 'radius')
+
+ # Migrate RADIUS server
+ radius_server = base + ['authentication', 'radius-server']
+ if config.exists(radius_server):
+ new_base = base + ['authentication', 'radius', 'server']
+ config.set(new_base)
+ config.set_tag(new_base)
+ for server in config.list_nodes(radius_server):
+ old_base = radius_server + [server]
+ config.copy(old_base, new_base + [server])
+
+ # remove old req-limit node
+ if config.exists(new_base + [server, 'req-limit']):
+ config.delete(new_base + [server, 'req-limit'])
+
+ config.delete(radius_server)
# Migrate IPv6 prefixes
ipv6_base = base + ['client-ipv6-pool']