]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: follow-up on PR #42727 43927/head
authorGuillaume Abrioux <gabrioux@redhat.com>
Mon, 15 Nov 2021 14:34:48 +0000 (15:34 +0100)
committerGuillaume Abrioux <gabrioux@redhat.com>
Mon, 15 Nov 2021 15:02:46 +0000 (16:02 +0100)
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 <gabrioux@redhat.com>
src/ceph-volume/ceph_volume/devices/raw/list.py

index c86d4996f8d05699e1c5e3297ea10dbd412d9abd..e1958231ef1f82d4064232966f9316453c437d2f 100644 (file)
@@ -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