diff options
author | Chris Lumens <clumens@redhat.com> | 2009-07-29 14:41:21 -0400 |
---|---|---|
committer | Chris Lumens <clumens@redhat.com> | 2009-07-29 15:17:39 -0400 |
commit | f918e059356d996909ffe12702142cb23aee8157 (patch) | |
tree | 8ab9324625e463491a9268e16c4ad712802ffc4c /isys/isys.py | |
parent | 63ede14df82cbf0ab8fa4a580f6ab76ef6c5ba8f (diff) | |
download | anaconda-f918e059356d996909ffe12702142cb23aee8157.tar.gz anaconda-f918e059356d996909ffe12702142cb23aee8157.tar.xz anaconda-f918e059356d996909ffe12702142cb23aee8157.zip |
NM no longer exposes information through HAL (#514501).
We need to use dbus and udev now, instead of the HAL interface. In
the future, we need to adapt code from storage/udev.py to be less tied
to block devices, since network devices use this same interface now.
Diffstat (limited to 'isys/isys.py')
-rwxr-xr-x | isys/isys.py | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/isys/isys.py b/isys/isys.py index 48909c7a4..f4aeaeccc 100755 --- a/isys/isys.py +++ b/isys/isys.py @@ -55,10 +55,6 @@ NM_STATE_CONNECTING = 2 NM_STATE_CONNECTED = 3 NM_STATE_DISCONNECTED = 4 -HAL_SERVICE = "org.freedesktop.Hal" -HAL_PATH = "/org/freedesktop/Hal" -HAL_DEVICE_IFACE = "org.freedesktop.Hal.Device" - DBUS_PROPS_IFACE = "org.freedesktop.DBus.Properties" mountCount = {} @@ -584,6 +580,7 @@ def getMacAddress(dev): # Get a description string for a network device (e.g., eth0) def getNetDevDesc(dev): + from storage.udev import udev_get_block_device desc = "Network Interface" if dev == '' or dev is None: @@ -594,19 +591,19 @@ def getNetDevDesc(dev): devlist = nm.get_dbus_method("GetDevices")() for path in devlist: - device = bus.get_object(HAL_SERVICE, path) - device_iface = dbus.Interface(device, HAL_DEVICE_IFACE) - device_props = device_iface.get_dbus_method("GetAllProperties")() - - if dev == device_props['net.interface']: - if device_props.has_key('info.product'): - if device_props.has_key('info.vendor'): - desc = "%s %s" % (device_props['info.product'], - device_props['info.vendor'],) - else: - desc = device_props['info.product'] - else: - desc = device_props['info.udi'] + device = bus.get_object(NM_SERVICE, path) + device_iface = dbus.Interface(device, DBUS_PROPS_IFACE) + device_props = device_iface.get_dbus_method("GetAll")(NM_DEVICE_IFACE) + + if dev == device_props['Interface']: + # This is the sysfs path (for now). + udev_path = device_props['Udi'] + dev = udev_get_block_device(udev_path, requireName=False) + + if dev.has_key("ID_VENDOR_ENC") and dev.has_key("ID_MODEL_ENC"): + desc = "%s %s" % (dev["ID_VENDOR_ENC"], dev["ID_MODEL_ENC"]) + elif dev.has_key("ID_VENDOR_FROM_DATABASE") and dev.has_key("ID_MODEL_FROM_DATABASE"): + desc = "%s %s" % (dev["ID_VENDOR_FROM_DATABASE"], dev["ID_MODEL_FROM_DATABASE"]) return desc |