diff options
| author | Jenkins <jenkins@review.openstack.org> | 2015-10-12 09:49:37 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2015-10-12 09:49:37 +0000 |
| commit | 5e73b19818cd766abb5efba3d0dc41b43f9df2bb (patch) | |
| tree | dec0c4337c1bc68eea4e62658d6d5afd425499f5 | |
| parent | 0cefd644502c7a8851403cbb2e60dd79c906d475 (diff) | |
| parent | c6bf42d07f4b45d7ec8ce6ebb007f398dc6e0b57 (diff) | |
| download | kolla-5e73b19818cd766abb5efba3d0dc41b43f9df2bb.tar.gz kolla-5e73b19818cd766abb5efba3d0dc41b43f9df2bb.zip | |
Merge "Ignore the 'Disk Flags:' line in parted"
| -rw-r--r-- | ansible/library/find_disks.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/ansible/library/find_disks.py b/ansible/library/find_disks.py index fe2a638b2..d7f166fc9 100644 --- a/ansible/library/find_disks.py +++ b/ansible/library/find_disks.py @@ -63,17 +63,19 @@ def main(): for line in disks: d = line.split(' ') - if d[0] == 'Disk': + if d[0] == 'Disk' and d[1] != 'Flags:': dev = d[1][:-1] if line.find(partition_name) != -1: # This process returns an error code when no results return # We can ignore that, it is safe 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 - if fs_uuid: - fs_uuid = fs_uuid.split('"')[1] + if ' UUID=' in blkid_out: + fs_uuid = blkid_out.split(' UUID="')[1].split('"')[0] + else: + fs_uuid = '' ret.append({'device': dev, 'fs_uuid': fs_uuid}) module.exit_json(disks=ret) |
