diff options
author | David Cantrell <dcantrell@redhat.com> | 2009-10-07 21:17:53 -1000 |
---|---|---|
committer | David Cantrell <dcantrell@redhat.com> | 2009-10-07 22:25:12 -1000 |
commit | c8b85a82aa9e9631b2ca7318cbf48ccf56ce2d07 (patch) | |
tree | 0b4820fc88d9c51d340f5c408ef8a0d2ff10a0af /storage | |
parent | 2dad219a3032c488e4715f8ca7710591ed54951c (diff) | |
download | anaconda-c8b85a82aa9e9631b2ca7318cbf48ccf56ce2d07.tar.gz anaconda-c8b85a82aa9e9631b2ca7318cbf48ccf56ce2d07.tar.xz anaconda-c8b85a82aa9e9631b2ca7318cbf48ccf56ce2d07.zip |
Make storage.devices.deviceNameToDiskByPath() more robust.
Have deviceNameToDiskByPath() return the full device path rather than
just the basename path. Have it check to see if the entry in
/dev/disk/by-path is actually a symlink, then readlink that. Otherwise
just take the basename of the entry. Also fix a problem where passing
it a full device path would not match (e.g., '/dev/dasdb1'). Take the
basename of deviceName and match that against the readlink() value.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/devices.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/storage/devices.py b/storage/devices.py index ca307bd36..8d7623b86 100644 --- a/storage/devices.py +++ b/storage/devices.py @@ -154,10 +154,18 @@ def deviceNameToDiskByPath(deviceName=None): if not os.path.isdir(bypath): return "" + deviceName = os.path.basename(deviceName) + for path in os.listdir(bypath): - target = os.path.basename(os.readlink(bypath + '/' + path)) + entry = bypath + '/' + path + + if os.path.islink(entry): + target = os.path.basename(os.readlink(entry)) + else: + target = os.path.basename(entry) + if target == deviceName: - return path + return entry return "" |