summaryrefslogtreecommitdiffstats
path: root/command-stubs
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 /command-stubs
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 'command-stubs')
-rwxr-xr-xcommand-stubs/list-harddrives-stub48
1 files changed, 38 insertions, 10 deletions
diff --git a/command-stubs/list-harddrives-stub b/command-stubs/list-harddrives-stub
index ceb60368d..a8060b15b 100755
--- a/command-stubs/list-harddrives-stub
+++ b/command-stubs/list-harddrives-stub
@@ -18,20 +18,48 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
+import dbus
import sys
-sys.path.append('/usr/lib/anaconda')
+HAL_INTERFACE = "org.freedesktop.Hal"
+HAL_MANAGER_PATH = "/org/freedesktop/Hal/Manager"
+HAL_MANAGER_INTERFACE = "org.freedesktop.Hal.Manager"
+HAL_DEVICE_INTERFACE = "org.freedesktop.Hal.Device"
-import minihal
+def main(argv):
+ lst = set()
-lst = []
+ try:
+ bus = dbus.SystemBus()
+ hal = dbus.Interface(bus.get_object(HAL_INTERFACE,
+ HAL_MANAGER_PATH),
+ HAL_MANAGER_INTERFACE)
+ except:
+ sys.exit(1)
-for drive in minihal.get_devices_by_type("volume"):
- if not drive.has_key("device") or not drive.has_key("volume.size"):
- continue
+ for udi in hal.FindDeviceByCapability("volume"):
+ try:
+ haldev = dbus.Interface(bus.get_object(HAL_INTERFACE, udi),
+ HAL_DEVICE_INTERFACE)
+ props = haldev.GetAllProperties()
+ except dbus.exceptions.DBusException:
+ continue
- lst.append("%s %s" % (drive["device"], drive["volume_size"]/(1024*1024)))
+ if not props.has_key('volume.size'):
+ continue
-lst.sort()
-for entry in lst:
- print lst
+ size = str(props['volume.size'] / (1024 * 1024))
+ if props.has_key('block.device'):
+ devnode = props['block.device'].encode('utf-8')
+ elif props.has_key('linux.device_file'):
+ devnode = props['linux.device_file'].encode('utf-8')
+
+ lst.add("%s %s" % (devnode, size,))
+
+ lst = list(lst)
+ lst.sort()
+ for entry in lst:
+ print entry
+
+if __name__ == "__main__":
+ main(sys.argv)