diff options
author | Eshenko Dmitriy <snooppy@mail.ua> | 2019-11-18 23:15:08 +0300 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-11-18 21:16:41 +0100 |
commit | af168aa1cceb420350955b62f5ae31e05978e5c1 (patch) | |
tree | 47b5821e1e0c145cc08c0bea28e1f43f3aea69d0 /src/migration-scripts/l2tp/0-to-1 | |
parent | fa4dd7e9ad6897ded3fd1877aff18420de178ed2 (diff) | |
download | vyos-1x-af168aa1cceb420350955b62f5ae31e05978e5c1.tar.gz vyos-1x-af168aa1cceb420350955b62f5ae31e05978e5c1.zip |
migration-scripts: l2tp: T1811: add missing check on server existence
(cherry picked from commit fb72bc367234bf35628bdccf84b0b76108f6341e)
Diffstat (limited to 'src/migration-scripts/l2tp/0-to-1')
-rwxr-xr-x | src/migration-scripts/l2tp/0-to-1 | 19 |
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']): |