From e035548f88388cd12f54a94b4c89bac97ad09ba6 Mon Sep 17 00:00:00 2001
From: Christian Poessinger <christian@poessinger.com>
Date: Thu, 6 Feb 2020 08:05:37 +0100
Subject: migrator: system: add missing if when checking user level in 9-to-10

---
 src/migration-scripts/system/9-to-10 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'src')

diff --git a/src/migration-scripts/system/9-to-10 b/src/migration-scripts/system/9-to-10
index 885ef819f..3c49f0d95 100755
--- a/src/migration-scripts/system/9-to-10
+++ b/src/migration-scripts/system/9-to-10
@@ -24,8 +24,9 @@ if not config.exists(base_level):
     sys.exit(0)
 else:
     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)
+        if config.exists(base_level + [user, '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