diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-04-18 21:30:57 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-04-18 21:35:28 +0200 |
commit | 68ebb2a39c6d98a4d2cc25b9b84e4a9594238608 (patch) | |
tree | 61c5591d6819b0aea0c2da94c5e1c12aca7dd6c2 /src/migration-scripts | |
parent | b6e5515aeb4d9781e0cb3508f1d07b84b1ad0ac8 (diff) | |
download | vyos-1x-68ebb2a39c6d98a4d2cc25b9b84e4a9594238608.tar.gz vyos-1x-68ebb2a39c6d98a4d2cc25b9b84e4a9594238608.zip |
pppoe-server: T2314: fix RADIUS migration
Diffstat (limited to 'src/migration-scripts')
-rwxr-xr-x | src/migration-scripts/pppoe-server/2-to-3 | 27 |
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'] |