Ignore devices with OSError
This bug handles OSError when trying to read from CDrom devices with no disc in the is_pristine_disk function which makes the run-action list-disks to fail. Change-Id: I5e86895d1adff3f95c7feb5ed0f78b998c28ed1f Depends-On: I951897a699305604821f2c910ee9ea91582c4e40 Closes-Bug: #1833857 Signed-off-by: Alexandros Soumplis <soumplis@admin.grnet.gr>
This commit is contained in:
parent
d6dc3c794b
commit
df8f477cd7
|
@ -913,7 +913,12 @@ def is_pristine_disk(dev):
|
|||
"""
|
||||
want_bytes = 2048
|
||||
|
||||
f = open(dev, 'rb')
|
||||
try:
|
||||
f = open(dev, 'rb')
|
||||
except OSError as e:
|
||||
log(e)
|
||||
return False
|
||||
|
||||
data = f.read(want_bytes)
|
||||
read_bytes = len(data)
|
||||
if read_bytes != want_bytes:
|
||||
|
|
Loading…
Reference in New Issue