From 9be9fa95648970a5001566e5dd3960cd77f3b2c3 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Thu, 6 Feb 2020 08:04:09 +0100 Subject: migrator: system: use base_level in 9-to-10 --- src/migration-scripts/system/9-to-10 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') 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()) -- cgit v1.2.3