]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
task/ceph_ansible: Fix attribute handling 1747/head
authorZack Cerza <zack@redhat.com>
Tue, 19 Apr 2022 23:44:16 +0000 (17:44 -0600)
committerZack Cerza <zack@redhat.com>
Tue, 19 Apr 2022 23:46:31 +0000 (17:46 -0600)
... in get_host_vars(). This had broken unit tests when a top-level
"ceph_ansible" key is present in the teuthology config.

Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/task/ceph_ansible.py

index a91403f79f58ba39297486c61ec4e591dcdea25b..18321d9e103efc1f4c161246cb156f36e4b05d0d 100644 (file)
@@ -296,8 +296,11 @@ class CephAnsible(Task):
             roles = self.ctx.cluster.remotes[remote]
             dev_needed = len([role for role in roles
                               if role.startswith('osd')])
-            if teuth_config.get('ceph_ansible') and \
-                    self.ctx.machine_type in teuth_config['ceph_ansible']['has_lvm_scratch_disks']:
+            if (
+                    teuth_config.get('ceph_ansible') and 
+                    hasattr(self.ctx, "machine_type") and
+                    self.ctx.machine_type in teuth_config['ceph_ansible']['has_lvm_scratch_disks']
+                ):
                 devices = get_file(remote, "/scratch_devs").decode().split()
                 vols = []