summaryrefslogtreecommitdiffstats
path: root/storage/udev.py
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2009-07-29 14:19:04 -0400
committerChris Lumens <clumens@redhat.com>2009-07-29 15:17:38 -0400
commit530c62b7b06d9dd6be28ece348147a0f083ea5e7 (patch)
tree0f442eb94a52d0723b2e95d2fb8964dcc6d8eae2 /storage/udev.py
parentf4789c3ec9151eb6bbb1191d43011929254b1fc6 (diff)
downloadanaconda-530c62b7b06d9dd6be28ece348147a0f083ea5e7.tar.gz
anaconda-530c62b7b06d9dd6be28ece348147a0f083ea5e7.tar.xz
anaconda-530c62b7b06d9dd6be28ece348147a0f083ea5e7.zip
Move the decision to ignore the results of udev_parse_block_entry up.
Network devices do not necessarily have a N: and S: entry in the udev info, so we don't want to ignore those right out. Instead, move the decision up into the caller and just have udev_parse_block_entry read all the info and shove it into a hash.
Diffstat (limited to 'storage/udev.py')
-rw-r--r--storage/udev.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/storage/udev.py b/storage/udev.py
index e97d5d528..b6f664381 100644
--- a/storage/udev.py
+++ b/storage/udev.py
@@ -114,7 +114,7 @@ def udev_get_block_device(sysfs_path):
entry = open(db_path).read()
dev = udev_parse_block_entry(entry)
- if dev:
+ if dev.has_key("name"):
# XXX why do we do this? is /sys going to move during installation?
dev['sysfs_path'] = sysfs_path[4:] # strip off the leading '/sys'
dev = udev_parse_uevent_file(dev)
@@ -138,8 +138,7 @@ def udev_parse_uevent_file(dev):
return dev
def udev_parse_block_entry(buf):
- dev = {'name': None,
- 'symlinks': []}
+ dev = {}
for line in buf.splitlines():
line.strip()
@@ -150,7 +149,10 @@ def udev_parse_block_entry(buf):
if tag == "N":
dev['name'] = val
elif tag == "S":
- dev['symlinks'].append(val)
+ if dev.has_key('symlinks'):
+ dev['symlinks'].append(val)
+ else:
+ dev['symlinks'] = [val]
elif tag == "E":
if val.count("=") > 1 and val.count(" ") > 0:
# eg: LVM2_LV_NAME when querying the VG for its LVs
@@ -174,8 +176,7 @@ def udev_parse_block_entry(buf):
dev[var_name] = var_val
- if dev.get("name"):
- return dev
+ return dev
def udev_settle(timeout=None):
argv = ["settle"]