]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
py3: cast dict_keys to list
authorKyr Shatskyy <kyrylo.shatskyy@gmail.com>
Thu, 12 Dec 2019 22:48:43 +0000 (23:48 +0100)
committerKyr Shatskyy <kyrylo.shatskyy@gmail.com>
Fri, 13 Dec 2019 16:49:38 +0000 (17:49 +0100)
Addresses:

  TypeError: 'dict_keys' object does not support indexing

and:

  RuntimeError: dictionary changed size during iteration

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
teuthology/misc.py
teuthology/nuke/__init__.py
teuthology/task/internal/__init__.py
teuthology/task/internal/vm_setup.py
teuthology/task/kernel.py

index 16aeb0d373caa863ec40b40d78c563111c946411..4c9dab01c328d8a414a4e4a13455b9cb2d78ef5f 100644 (file)
@@ -944,7 +944,7 @@ def reconnect(ctx, timeout, remotes=None):
     if remotes:
         need_reconnect = remotes
     else:
-        need_reconnect = ctx.cluster.remotes.keys()
+        need_reconnect = list(ctx.cluster.remotes.keys())
 
     while need_reconnect:
         for remote in need_reconnect:
index 5c105ef3df2743f30c9b77a03c838243967a91db..8370e4d94fde5a489c47829fa81aadc642c8b928 100644 (file)
@@ -296,7 +296,7 @@ def nuke_one(ctx, target, should_unlock, synch_clocks, reboot_all,
         ret = target
     else:
         if should_unlock:
-            unlock_one(ctx, target.keys()[0], ctx.owner)
+            unlock_one(ctx, list(target.keys())[0], ctx.owner)
     return ret
 
 
index 5f00653b440937f6bfdeb2f5562da5554a9c2564..a539923039877160543a2ddcc59e55c76f7eb830 100644 (file)
@@ -68,7 +68,7 @@ def check_packages(ctx, config):
     If there are missing packages, fail the job.
     """
     for task in ctx.config['tasks']:
-        if task.keys()[0] == 'buildpackages':
+        if list(task.keys())[0] == 'buildpackages':
             log.info("Checking packages skipped because "
                      "the task buildpackages was found.")
             return
@@ -227,7 +227,7 @@ def buildpackages_prep(ctx, config):
             return BUILDPACKAGES_OK
     elif buildpackages_index is not None and install_index is None:
         ctx.config['tasks'].pop(buildpackages_index)
-        all_tasks = [x.keys()[0] for x in ctx.config['tasks']]
+        all_tasks = [list(x.keys())[0] for x in ctx.config['tasks']]
         log.info('buildpackages removed because no install task found in ' +
                  str(all_tasks))
         return BUILDPACKAGES_REMOVED
index 27ecd8b7e62d37f54b898264fc6589f091f5093d..828eff184378d50508e4804d45ac5c487c23ad5f 100644 (file)
@@ -14,7 +14,7 @@ def vm_setup(ctx, config):
     """
     Look for virtual machines and handle their initialization
     """
-    all_tasks = [x.keys()[0] for x in ctx.config['tasks']]
+    all_tasks = [list(x.keys())[0] for x in ctx.config['tasks']]
     need_ansible = False
     if 'kernel' in all_tasks and 'ansible.cephlab' not in all_tasks:
         need_ansible = True
index 5bc50420582ec27a9936a95c3bd34f01421489cb..2af798111b31b57674b956656b1b8bc1e9259b14 100644 (file)
@@ -682,7 +682,7 @@ def wait_for_reboot(ctx, need_install, timeout, distro=False):
     starttime = time.time()
     while need_install:
         teuthology.reconnect(ctx, timeout)
-        for client in need_install.keys():
+        for client in list(need_install.keys()):
             if 'distro' in str(need_install[client]):
                  distro = True
             log.info('Checking client {client} for new kernel version...'.format(client=client))