From 8130e5829fcd3149e712c18c4d97f9c08f9a8f51 Mon Sep 17 00:00:00 2001 From: Kyr Shatskyy Date: Mon, 18 Nov 2019 16:24:24 +0100 Subject: [PATCH] test/ansible: handle dict keys as list for py3 Signed-off-by: Kyr Shatskyy --- teuthology/task/ansible.py | 4 ++-- teuthology/test/task/test_ansible.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/teuthology/task/ansible.py b/teuthology/task/ansible.py index 6e0d61823..823bb20fc 100644 --- a/teuthology/task/ansible.py +++ b/teuthology/task/ansible.py @@ -290,7 +290,7 @@ class Ansible(Task): self._handle_failure(command, status) if self.config.get('reconnect', True) is True: - remotes = self.cluster.remotes.keys() + remotes = list(self.cluster.remotes) log.debug("Reconnecting to %s", remotes) for remote in remotes: remote.reconnect() @@ -338,7 +338,7 @@ class Ansible(Task): """ fqdns = [r.hostname for r in self.cluster.remotes.keys()] # Assume all remotes use the same username - user = self.cluster.remotes.keys()[0].user + user = list(self.cluster.remotes)[0].user extra_vars = dict(ansible_ssh_user=user) extra_vars.update(self.config.get('vars', dict())) args = [ diff --git a/teuthology/test/task/test_ansible.py b/teuthology/test/task/test_ansible.py index a1a1f1f1c..15d22ace3 100644 --- a/teuthology/test/task/test_ansible.py +++ b/teuthology/test/task/test_ansible.py @@ -72,7 +72,7 @@ class TestAnsibleTask(TestTask): self.stop_patchers() def stop_patchers(self): - for name in self.mocks.keys(): + for name in list(self.mocks): self.stop_patcher(name) def stop_patcher(self, name): @@ -416,7 +416,7 @@ class TestAnsibleTask(TestTask): assert args.count('--extra-vars') == 1 vars_str = args[args.index('--extra-vars') + 1].strip("'") extra_vars = json.loads(vars_str) - assert extra_vars.keys() == ['ansible_ssh_user'] + assert list(extra_vars) == ['ansible_ssh_user'] def test_build_args_vars(self): extra_vars = dict( -- 2.47.3