From: Guillaume Abrioux Date: Tue, 17 Sep 2024 12:00:23 +0000 (+0200) Subject: orch: Fix `daemon add osd` boolean param handling X-Git-Tag: v19.2.1~180^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=5c2ecd28bb96eaeb7d1be1ee571d2c86be494108;p=ceph.git orch: Fix `daemon add osd` boolean param handling - Correct usage examples for 'ceph orch daemon add osd' - Fix boolean argument handling for drive group specifications Fixes: https://tracker.ceph.com/issues/68045 Signed-off-by: Guillaume Abrioux (cherry picked from commit 45327462e0949638b37f66f9cceff2ff5ef07242) --- diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index b90f3c75b58e5..246818b040ab5 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -1335,8 +1335,8 @@ class OrchestratorCli(OrchestratorClientMixin, MgrModule, usage = """ Usage: ceph orch daemon add osd host:device1,device2,... - ceph orch daemon add osd host:data_devices=device1,device2,db_devices=device3,osds_per_device=2[,encrypted=true|True|1] - ceph orch daemon add osd host:data_devices=device1[,encrypted=false|False|0] + ceph orch daemon add osd host:data_devices=device1,device2,db_devices=device3,osds_per_device=2[,encrypted=false] + ceph orch daemon add osd host:data_devices=device1[,encrypted=true,tpm2=true] """ if not svc_arg: return HandleCommandResult(-errno.EINVAL, stderr=usage) @@ -1358,10 +1358,12 @@ Usage: 'journal_devices']: drive_group_spec[drv_grp_spec_arg] = [] drive_group_spec[drv_grp_spec_arg].append(value) + else: if value.lower() in ['true', 'false']: list_drive_group_spec_bool_arg.append(drv_grp_spec_arg) - else: - drive_group_spec[drv_grp_spec_arg] = value + drive_group_spec[drv_grp_spec_arg] = value.lower() == "true" + else: + drive_group_spec[drv_grp_spec_arg] = value elif drv_grp_spec_arg is not None: drive_group_spec[drv_grp_spec_arg].append(v) else: @@ -1372,10 +1374,6 @@ Usage: drive_group_spec[dev_type] = DeviceSelection( paths=drive_group_spec[dev_type]) if drive_group_spec.get(dev_type) else None - for drive_group_spec_bool_arg in list_drive_group_spec_bool_arg: - drive_group_spec_value: str = drive_group_spec[drive_group_spec_bool_arg] - drive_group_spec[drive_group_spec_bool_arg] = drive_group_spec_value.lower() == "true" - drive_group = DriveGroupSpec( placement=PlacementSpec(host_pattern=host_name), method=method,