From b6d5a0790fd09fbb1f7eef6faef738cd50bd40cb Mon Sep 17 00:00:00 2001 From: Sergii Golovatiuk Date: Thu, 10 Nov 2022 12:37:40 +0100 Subject: [PATCH 39/63] Fix cephvolume actor Change cephvolume behavior to return None when ceph-osd container is not found. Fixes: rhbz#2141393 --- .../actors/cephvolumescan/libraries/cephvolumescan.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/repos/system_upgrade/common/actors/cephvolumescan/libraries/cephvolumescan.py b/repos/system_upgrade/common/actors/cephvolumescan/libraries/cephvolumescan.py index 7e3d544c..19f49528 100644 --- a/repos/system_upgrade/common/actors/cephvolumescan/libraries/cephvolumescan.py +++ b/repos/system_upgrade/common/actors/cephvolumescan/libraries/cephvolumescan.py @@ -12,7 +12,6 @@ CONTAINER = "ceph-osd" def select_osd_container(engine): - container_name = "" try: output = run([engine, 'ps']) except CalledProcessError as cpe: @@ -24,7 +23,7 @@ def select_osd_container(engine): container_name = line.split()[-1] if re.match(CONTAINER, container_name): return container_name - return container_name + return None def get_ceph_lvm_list(): @@ -35,6 +34,8 @@ def get_ceph_lvm_list(): cmd_ceph_lvm_list = base_cmd else: container_name = select_osd_container(container_binary) + if container_name is None: + return None cmd_ceph_lvm_list = [container_binary, 'exec', container_name] cmd_ceph_lvm_list.extend(base_cmd) try: @@ -58,5 +59,6 @@ def encrypted_osds_list(): result = [] if os.path.isfile(CEPH_CONF): output = get_ceph_lvm_list() - result = [output[key][0]['lv_uuid'] for key in output if output[key][0]['tags']['ceph.encrypted']] + if output is not None: + result = [output[key][0]['lv_uuid'] for key in output if output[key][0]['tags']['ceph.encrypted']] return result -- 2.39.0