summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-04-23 13:25:23 +0200
committerChristian Poessinger <christian@poessinger.com>2019-04-23 13:25:26 +0200
commit90481dca0bcac6def83600cd5906e53384aacfa6 (patch)
tree9df15f6332f5dcd082b64011d34d195a38bd2c22
parent7d024a324412f4902b9ba212277901bbbe2f949c (diff)
downloadvyos-1x-90481dca0bcac6def83600cd5906e53384aacfa6.tar.gz
vyos-1x-90481dca0bcac6def83600cd5906e53384aacfa6.zip
[migration] T1344: extend migration script for radius-source-address
radius-source-address was backported to vyOS 1.2.2 so also migrate this node.
-rwxr-xr-xsrc/migration-scripts/system/10-to-1120
1 files changed, 16 insertions, 4 deletions
diff --git a/src/migration-scripts/system/10-to-11 b/src/migration-scripts/system/10-to-11
index e6467243c..1a0233c7d 100755
--- a/src/migration-scripts/system/10-to-11
+++ b/src/migration-scripts/system/10-to-11
@@ -1,11 +1,11 @@
#!/usr/bin/env python3
-# Unclutter RADIUS configuiration for 'system login radius-server'
+# Unclutter RADIUS configuration
+#
# Move radius-server top level tag nodes to a regular node which allows us
-# to specify additional general features for the RADIUS client
+# to specify additional general features for the RADIUS client.
import sys
-
from vyos.configtree import ConfigTree
if (len(sys.argv) < 1):
@@ -19,12 +19,24 @@ with open(file_name, 'r') as f:
config = ConfigTree(config_file)
cfg_base = ['system', 'login']
-if not config.exists(cfg_base + ['radius-server']):
+if not (config.exists(cfg_base + ['radius-server']) or config.exists(cfg_base + ['radius-source-address'])):
# Nothing to do
sys.exit(0)
else:
+ #
+ # Migrate "system login radius-source-address" to "system login radius"
+ #
+ if config.exists(cfg_base + ['radius-source-address']):
+ address = config.return_value(cfg_base + ['radius-source-address'])
+ # delete old configuration node
+ config.delete(cfg_base + ['radius-source-address'])
+ # write new configuration node
+ config.set(cfg_base + ['radius', 'source-address'], value=address)
+
+ #
# Migrate "system login radius-server" tag node to new
# "system login radius server" tag node and also rename the "secret" node to "key"
+ #
for server in config.list_nodes(cfg_base + ['radius-server']):
base_server = cfg_base + ['radius-server', server]
# "key" node is mandatory