[PATCH 09/17] Replace isWirelessDevice() using new nm module

Radek Vykydal rvykydal at redhat.com
Fri Feb 8 14:04:25 UTC 2013


---
 pyanaconda/installclasses/fedora.py |  4 ++--
 pyanaconda/network.py               | 18 ------------------
 2 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/pyanaconda/installclasses/fedora.py b/pyanaconda/installclasses/fedora.py
index bb77515..f93c81d 100644
--- a/pyanaconda/installclasses/fedora.py
+++ b/pyanaconda/installclasses/fedora.py
@@ -117,13 +117,13 @@ class InstallClass(BaseInstallClass):
     def setNetworkOnbootDefault(self, ksdata):
         # if something's already enabled, we can just leave the config alone
         for devName in nm.nm_devices():
-            if not network.isWirelessDevice(devName) and \
+            if not nm.nm_device_type_is_wifi(devName) and \
                network.get_ifcfg_value(devName, "ONBOOT", ROOT_PATH) == "yes":
                 return
 
         # the default otherwise: bring up the first wired netdev with link
         for devName in nm.nm_devices():
-            if network.isWirelessDevice(devName):
+            if nm.nm_device_type_is_wifi(devName):
                 continue
             try:
                 link_up = nm.nm_device_carrier(devName)
diff --git a/pyanaconda/network.py b/pyanaconda/network.py
index 4bf0d99..9c9193a 100644
--- a/pyanaconda/network.py
+++ b/pyanaconda/network.py
@@ -146,24 +146,6 @@ def getMacAddress(dev):
         log.debug("getMacAddress %s: %s" % (dev, e))
     return device_macaddr
 
-# Determine if a network device is a wireless device.
-def isWirelessDevice(dev_name):
-    bus = dbus.SystemBus()
-    nm = bus.get_object(NM_SERVICE, NM_MANAGER_PATH)
-    devlist = nm.get_dbus_method("GetDevices")()
-
-    for path in devlist:
-        device = bus.get_object(NM_SERVICE, path)
-        device_props_iface = dbus.Interface(device, DBUS_PROPS_IFACE)
-
-        iface = device_props_iface.Get(NM_DEVICE_IFACE, "Interface")
-        if iface == dev_name:
-            device_type = device_props_iface.Get(NM_DEVICE_IFACE, "DeviceType")
-            return device_type == NM_DEVICE_TYPE_WIFI
-
-    return False
-
-
 # Get IP addresses for a network device.
 # Returns list of ipv4 or ipv6 addresses, depending
 # on version parameter. ipv4 is default.
-- 
1.7.11.7



More information about the anaconda-patches mailing list