]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
get dict's keys as list in py3 compatible way
authorKyr Shatskyy <kyrylo.shatskyy@suse.com>
Mon, 18 Nov 2019 16:58:04 +0000 (17:58 +0100)
committerKyr Shatskyy <kyrylo.shatskyy@suse.com>
Mon, 18 Nov 2019 17:50:59 +0000 (18:50 +0100)
Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
teuthology/task/internal/__init__.py
teuthology/test/task/__init__.py
teuthology/test/task/test_selinux.py

index 80832cbf6bd27634087e2ee3cc37b4e4f2f619a9..5f00653b440937f6bfdeb2f5562da5554a9c2564 100644 (file)
@@ -206,11 +206,12 @@ def buildpackages_prep(ctx, config):
     buildpackages_index = None
     buildpackages_prep_index = None
     for task in ctx.config['tasks']:
-        if task.keys()[0] == 'install':
+        t = list(task)[0]
+        if t == 'install':
             install_index = index
-        if task.keys()[0] == 'buildpackages':
+        if t == 'buildpackages':
             buildpackages_index = index
-        if task.keys()[0] == 'internal.buildpackages_prep':
+        if t == 'internal.buildpackages_prep':
             buildpackages_prep_index = index
         index += 1
     if (buildpackages_index is not None and
index f03737e8cf1d9375b4c5cdf1cc3bd7e0f04d5e26..6fae57a8107ecce4436ffa168f032ece991a5b3d 100644 (file)
@@ -44,7 +44,7 @@ class TestTask(object):
             end=DEFAULT,
         ):
             with self.klass(self.ctx, self.task_config) as task:
-                task_hosts = task.cluster.remotes.keys()
+                task_hosts = list(task.cluster.remotes)
                 assert len(task_hosts) == 2
                 assert sorted(host.shortname for host in task_hosts) == \
                     ['remote1', 'remote2']
@@ -77,7 +77,7 @@ class TestTask(object):
             end=DEFAULT,
         ):
             with self.klass(self.ctx, self.task_config) as task:
-                task_hosts = task.cluster.remotes.keys()
+                task_hosts = list(task.cluster.remotes)
                 assert len(task_hosts) == 1
                 assert task_hosts[0].shortname == 'remote1'
 
@@ -95,7 +95,7 @@ class TestTask(object):
             end=DEFAULT,
         ):
             with self.klass(self.ctx, self.task_config) as task:
-                task_hosts = task.cluster.remotes.keys()
+                task_hosts = list(task.cluster.remotes)
                 assert len(task_hosts) == 2
                 hostnames = [host.shortname for host in task_hosts]
                 assert sorted(hostnames) == ['remote1', 'remote3']
@@ -114,7 +114,7 @@ class TestTask(object):
             end=DEFAULT,
         ):
             with self.klass(self.ctx, self.task_config) as task:
-                task_hosts = task.cluster.remotes.keys()
+                task_hosts = list(task.cluster.remotes)
                 assert len(task_hosts) == 2
                 hostnames = [host.hostname for host in task_hosts]
                 assert sorted(hostnames) == ['remote1.example.com',
@@ -134,7 +134,7 @@ class TestTask(object):
             end=DEFAULT,
         ):
             with self.klass(self.ctx, self.task_config) as task:
-                task_hosts = task.cluster.remotes.keys()
+                task_hosts = list(task.cluster.remotes)
                 assert len(task_hosts) == 2
                 hostnames = [host.hostname for host in task_hosts]
                 assert sorted(hostnames) == ['remote1.example.com',
index e12e81c0a928e9833010aa9d160d72752b028991..ddbff06d08a54348c59aa6390e07544d1e2bd0d5 100644 (file)
@@ -30,6 +30,6 @@ class TestSELinux(object):
             self.ctx.cluster.add(remote2, ['role2'])
             task_config = dict()
             with SELinux(self.ctx, task_config) as task:
-                remotes = task.cluster.remotes.keys()
+                remotes = list(task.cluster.remotes)
                 assert remotes == [remote1]