Skip to content

Commit cca2505

Browse files
committed
Handle review comments
1 parent b728e23 commit cca2505

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

test/integration/component/test_configdrive.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,20 +337,27 @@ def _mount_config_drive(self, ssh):
337337
"""
338338
This method is to verify whether configdrive iso
339339
is attached to vm or not
340-
Returns mount path if config drive is attached else False
340+
Returns mount path if config drive is attached else None
341341
"""
342342
mountdir = "/root/iso"
343343
cmd = "blkid -t LABEL='config-2' " \
344344
"/dev/sr? /dev/hd? /dev/sd? /dev/xvd? -o device"
345345
tmp_cmd = [
346-
'bash -c "if [ ! -d /root/iso ] ; then mkdir /root/iso ; fi"',
347-
"umount /root/iso"]
346+
'bash -c "if [ ! -d {0} ]; then mkdir {0}; fi"'.format(mountdir),
347+
"umount %s" % mountdir]
348+
self.debug("Unmounting drive from %s" % mountdir)
348349
for tcmd in tmp_cmd:
349350
ssh.execute(tcmd)
351+
352+
self.debug("Trying to find ConfigDrive device")
350353
configDrive = ssh.execute(cmd)
354+
if not configDrive:
355+
self.warn("ConfigDrive is not attached")
356+
return None
357+
351358
res = ssh.execute("mount {} {}".format(str(configDrive[0]), mountdir))
352359
if str(res).lower().find("mounting read-only") > -1:
353-
self.debug("configDrive iso is mounted at location %s" % mountdir)
360+
self.debug("ConfigDrive iso is mounted at location %s" % mountdir)
354361
return mountdir
355362
else:
356363
return None

0 commit comments

Comments
 (0)