From 2c228a9a409176c0f1679f176443fd3ead219c7a Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Mon, 15 Nov 2021 15:34:48 +0100 Subject: [PATCH] ceph-volume: follow-up on PR #42727 PR #42727 introduced a regression in `ceph-volume raw activate` since it dropped `nargs='+'` from the argument `--device`, the variable is no longer a list but a string. Signed-off-by: Guillaume Abrioux --- src/ceph-volume/ceph_volume/devices/raw/list.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ceph-volume/ceph_volume/devices/raw/list.py b/src/ceph-volume/ceph_volume/devices/raw/list.py index c86d4996f8d..e1958231ef1 100644 --- a/src/ceph-volume/ceph_volume/devices/raw/list.py +++ b/src/ceph-volume/ceph_volume/devices/raw/list.py @@ -64,7 +64,12 @@ class List(object): def generate(self, devs=None): logger.debug('Listing block devices via lsblk...') - + # in case where we come from `ceph-volume raw activate` + # `--device` will call `List.list()` with a string instead of a list + # which can lead the logic in this function to a bug. The following lines will basically + # convert it to a list with a single element to be sure we don't hit any issue. + if isinstance(devs, str): + devs = [devs] if devs is None or devs == []: devs = [] # If no devs are given initially, we want to list ALL devices including children and -- 2.39.5