summaryrefslogtreecommitdiff
path: root/src/migration-scripts/l2tp
diff options
context:
space:
mode:
authorEshenko Dmitriy <snooppy@mail.ua>2019-11-18 23:15:08 +0300
committerChristian Poessinger <christian@poessinger.com>2019-11-18 21:15:08 +0100
commitfb72bc367234bf35628bdccf84b0b76108f6341e (patch)
tree6c18ebb3fa5cf3b9036dca8096d104d79c868419 /src/migration-scripts/l2tp
parent4e4f1dbd745952a24d70c3e2d7dc495d675dff34 (diff)
downloadvyos-1x-fb72bc367234bf35628bdccf84b0b76108f6341e.tar.gz
vyos-1x-fb72bc367234bf35628bdccf84b0b76108f6341e.zip
migration-scripts: l2tp: T1811: add missing check on server existence
Diffstat (limited to 'src/migration-scripts/l2tp')
-rwxr-xr-xsrc/migration-scripts/l2tp/0-to-119
1 files changed, 10 insertions, 9 deletions
diff --git a/src/migration-scripts/l2tp/0-to-1 b/src/migration-scripts/l2tp/0-to-1
index f6c716df1..686ebc655 100755
--- a/src/migration-scripts/l2tp/0-to-1
+++ b/src/migration-scripts/l2tp/0-to-1
@@ -35,17 +35,18 @@ else:
# Migrate "vpn l2tp authentication radius-server" tag node to new
# "vpn l2tp authentication radius server" tag node
- for server in config.list_nodes(cfg_base + ['radius-server']):
- base_server = cfg_base + ['radius-server', server]
- key = config.return_value(base_server + ['key'])
+ if config.exists(cfg_base + ['radius-server']):
+ for server in config.list_nodes(cfg_base + ['radius-server']):
+ base_server = cfg_base + ['radius-server', server]
+ key = config.return_value(base_server + ['key'])
- # delete old configuration node
- config.delete(base_server)
- # write new configuration node
- config.set(cfg_base + ['radius', 'server', server, 'key'], value=key)
+ # delete old configuration node
+ config.delete(base_server)
+ # write new configuration node
+ config.set(cfg_base + ['radius', 'server', server, 'key'], value=key)
- # format as tag node
- config.set_tag(cfg_base + ['radius', 'server'])
+ # format as tag node
+ config.set_tag(cfg_base + ['radius', 'server'])
# delete top level tag node
if config.exists(cfg_base + ['radius-server']):