diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-02-06 08:04:09 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-02-06 08:04:09 +0100 |
commit | 9be9fa95648970a5001566e5dd3960cd77f3b2c3 (patch) | |
tree | 5e41440ed73b5a4832be945ddd7d755c66e8a4a0 /src/migration-scripts/system/9-to-10 | |
parent | 30c202dfedf41abad55502c115b2a53f1901f47e (diff) | |
download | vyos-1x-9be9fa95648970a5001566e5dd3960cd77f3b2c3.tar.gz vyos-1x-9be9fa95648970a5001566e5dd3960cd77f3b2c3.zip |
migrator: system: use base_level in 9-to-10
Diffstat (limited to 'src/migration-scripts/system/9-to-10')
-rwxr-xr-x | src/migration-scripts/system/9-to-10 | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/migration-scripts/system/9-to-10 b/src/migration-scripts/system/9-to-10 index 006c98a75..885ef819f 100755 --- a/src/migration-scripts/system/9-to-10 +++ b/src/migration-scripts/system/9-to-10 @@ -16,15 +16,16 @@ with open(file_name, 'r') as f: config_file = f.read() config = ConfigTree(config_file) +base_level = ['system', 'login', 'user'] -if not config.exists(['system', 'login', 'user']): +if not config.exists(base_level): # Nothing to do, which shouldn't happen anyway # only if you wipe the config and reboot. sys.exit(0) else: - for usr in config.list_nodes(['system', 'login', 'user']): - if config.return_value(['system', 'login', 'user', usr, 'level']) == 'operator': - config.set(['system', 'login', 'user', usr, 'level'], value="admin", replace=True) + for user in config.list_nodes(base_level): + if config.return_value(base_level + [user, 'level']) == 'operator': + config.set(base_level + [user, 'level'], value="admin", replace=True) try: open(file_name,'w').write(config.to_string()) |