@@ -69,7 +69,7 @@ def __init__(self, argv):
6969 def generate (self , devs = None ):
7070 logger .debug ('Listing block devices via lsblk...' )
7171 info_devices = disk .lsblk_all (abspath = True )
72- if devs is None or devs == [] :
72+ if not devs or not any ( devs ) :
7373 # If no devs are given initially, we want to list ALL devices including children and
7474 # parents. Parent disks with child partitions may be the appropriate device to return if
7575 # the parent disk has a bluestore header, but children may be the most appropriate
@@ -88,10 +88,11 @@ def generate(self, devs=None):
8888 # parent isn't bluestore, then the child could be a valid bluestore OSD. If we fail to
8989 # determine whether a parent is bluestore, we should err on the side of not reporting
9090 # the child so as not to give a false negative.
91- info_device = [info for info in info_devices if info ['NAME' ] == dev ][ 0 ]
92- if info_device [ 'TYPE' ] == 'lvm' :
93- # lvm devices are not raw devices
91+ matched_info_devices = [info for info in info_devices if info ['NAME' ] == dev ]
92+ if not matched_info_devices :
93+ logger . warning ( 'device {} does not exist' . format ( dev ))
9494 continue
95+ info_device = matched_info_devices [0 ]
9596 if 'PKNAME' in info_device and info_device ['PKNAME' ] != "" :
9697 parent = info_device ['PKNAME' ]
9798 try :
0 commit comments