summaryrefslogtreecommitdiffstats
path: root/minihal.py
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2009-04-22 00:22:50 -1000
committerDavid Cantrell <dcantrell@redhat.com>2009-05-04 15:14:05 -1000
commit2d0cec6dbd804b3f02a6dd7ab6b390955ea3f660 (patch)
tree37ae68fa41a3d20918c0ee63655c34eb331018fc /minihal.py
parente77eaf1276e015b3d7a0d15c52e9f20ba7a4deae (diff)
downloadanaconda-2d0cec6dbd804b3f02a6dd7ab6b390955ea3f660.tar.gz
anaconda-2d0cec6dbd804b3f02a6dd7ab6b390955ea3f660.tar.xz
anaconda-2d0cec6dbd804b3f02a6dd7ab6b390955ea3f660.zip
Collect network interfaces from NetworkManager (#493995)
Remove minihal.py and use NetworkManager to get a list of device names and their hardware addresses. Still have to talk to hal via D-Bus to build a description string, but the hal path is given to us by NetworkManager, so we are sure we are only building a list of interfaces that NetworkManager knows about and can communicate with. Also rewrite command-stubs/list-harddrives to not use minihal.
Diffstat (limited to 'minihal.py')
-rw-r--r--minihal.py74
1 files changed, 0 insertions, 74 deletions
diff --git a/minihal.py b/minihal.py
deleted file mode 100644
index 8ab93d4bf..000000000
--- a/minihal.py
+++ /dev/null
@@ -1,74 +0,0 @@
-#
-# minihal.py: Simple wrapper around HAL
-#
-# Copyright (C) 2007 Red Hat, Inc. All rights reserved.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Author(s): Bill Nottingham <notting@redhat.com>
-#
-
-"""Simple wrapper around HAL"""
-
-import dbus
-
-def get_device(udi):
- """Retrieve all properties of a particular device (by UDI)"""
- try:
- bus = dbus.SystemBus()
- haldev = dbus.Interface(bus.get_object("org.freedesktop.Hal", udi), "org.freedesktop.Hal.Device")
- props = haldev.GetAllProperties()
- except dbus.exceptions.DBusException:
- return None
-
- if props.has_key('block.device'):
- props['device'] = props['block.device'].encode("utf-8")
- elif props.has_key('linux.device_file'):
- props['device'] = props['linux.device_file'].encode("utf-8")
- elif props.has_key('net.interface'):
- props['device'] = props['net.interface'].encode("utf-8")
- else:
- props['device'] = None
-
- props['description'] = ''
- if props.has_key('info.product'):
- if props.has_key('info.vendor'):
- props['description'] = '%s %s' % (props['info.vendor'],props['info.product'])
- else:
- props['description'] = props['info.product']
- else:
- props['description'] = props['info.udi']
- if props.has_key('net.originating_device'):
- pdev = get_device(props['net.originating_device'])
- props['description'] = pdev['description']
-
- # mmc block devices don't show up as disks (#481431)
- if props.has_key('storage.drive_type') and props['storage.drive_type'] == "sd_mmc":
- props['storage.drive_type'] = "disk"
-
- return props
-
-def get_devices_by_type(type):
- """Retrieve all devices of a particular type"""
- ret = []
- try:
- bus = dbus.SystemBus()
- hal = dbus.Interface(bus.get_object("org.freedesktop.Hal","/org/freedesktop/Hal/Manager"),"org.freedesktop.Hal.Manager")
- except:
- return ret
- for udi in hal.FindDeviceByCapability(type):
- dev = get_device(udi)
- if dev:
- ret.append(dev)
- return ret