Merge "Ignore the 'Disk Flags:' line in parted"
This commit is contained in:
commit
5e73b19818
@ -63,17 +63,19 @@ def main():
|
|||||||
|
|
||||||
for line in disks:
|
for line in disks:
|
||||||
d = line.split(' ')
|
d = line.split(' ')
|
||||||
if d[0] == 'Disk':
|
if d[0] == 'Disk' and d[1] != 'Flags:':
|
||||||
dev = d[1][:-1]
|
dev = d[1][:-1]
|
||||||
|
|
||||||
if line.find(partition_name) != -1:
|
if line.find(partition_name) != -1:
|
||||||
# This process returns an error code when no results return
|
# This process returns an error code when no results return
|
||||||
# We can ignore that, it is safe
|
# We can ignore that, it is safe
|
||||||
p = subprocess.Popen("blkid " + dev + "*", shell=True, stdout=subprocess.PIPE)
|
p = subprocess.Popen("blkid " + dev + "*", shell=True, stdout=subprocess.PIPE)
|
||||||
fs_uuid = p.communicate()[0]
|
blkid_out = p.communicate()[0]
|
||||||
# The dev doesn't need to have a uuid, will be '' otherwise
|
# The dev doesn't need to have a uuid, will be '' otherwise
|
||||||
if fs_uuid:
|
if ' UUID=' in blkid_out:
|
||||||
fs_uuid = fs_uuid.split('"')[1]
|
fs_uuid = blkid_out.split(' UUID="')[1].split('"')[0]
|
||||||
|
else:
|
||||||
|
fs_uuid = ''
|
||||||
ret.append({'device': dev, 'fs_uuid': fs_uuid})
|
ret.append({'device': dev, 'fs_uuid': fs_uuid})
|
||||||
|
|
||||||
module.exit_json(disks=ret)
|
module.exit_json(disks=ret)
|
||||||
|
Loading…
Reference in New Issue
Block a user