[PATCH] Update for NetworkManager 0.9

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This change is relevant on both f15 and rawhide, where I'll be building
NM 0.9 today.  You'll want to BuildRequire: NetworkManager-devel >=
0.8.995.  Essentially, the major NM states and the device states were
renumbered, which is what this patch updates.  Also updated is the
settings service name, which the python code doesn't use at all.  The C
loader pieces build fine for me locally.  If you'd like to retain
compatibility in the Python code with older versions of NM at the same
time as supporting 0.9, that's easy too, let me know if you want to do
that and I'll whip up a quick 4-line patch for it.

Dan
---

diff --git a/pyanaconda/isys/__init__.py b/pyanaconda/isys/__init__.py
index 7b4debc..d5e5bf5 100755
--- a/pyanaconda/isys/__init__.py
+++ b/pyanaconda/isys/__init__.py
@@ -51,18 +51,21 @@ NM_SERVICE = "org.freedesktop.NetworkManager"
 NM_MANAGER_PATH = "/org/freedesktop/NetworkManager"
 NM_MANAGER_IFACE = "org.freedesktop.NetworkManager"
 NM_ACTIVE_CONNECTION_IFACE = "org.freedesktop.NetworkManager.Connection.Active"
-NM_CONNECTION_IFACE = "org.freedesktop.NetworkManagerSettings.Connection"
+NM_CONNECTION_IFACE = "org.freedesktop.NetworkManager.Settings.Connection"
 NM_DEVICE_IFACE = "org.freedesktop.NetworkManager.Device"
 NM_IP4CONFIG_IFACE = "org.freedesktop.NetworkManager.IP4Config"
 NM_IP6CONFIG_IFACE = "org.freedesktop.NetworkManager.IP6Config"
 NM_ACCESS_POINT_IFACE = "org.freedesktop.NetworkManager.AccessPoint"
 
 NM_STATE_UNKNOWN = 0
-NM_STATE_ASLEEP = 1
-NM_STATE_CONNECTING = 2
-NM_STATE_CONNECTED = 3
-NM_STATE_DISCONNECTED = 4
-NM_DEVICE_STATE_ACTIVATED = 8
+NM_STATE_ASLEEP = 10
+NM_STATE_DISCONNECTED = 20
+NM_STATE_DISCONNECTING = 30
+NM_STATE_CONNECTING = 40
+NM_STATE_CONNECTED_LOCAL = 50
+NM_STATE_CONNECTED_SITE = 60
+NM_STATE_CONNECTED_GLOBAL = 70
+NM_DEVICE_STATE_ACTIVATED = 100
 
 DBUS_PROPS_IFACE = "org.freedesktop.DBus.Properties"
 
diff --git a/pyanaconda/network.py b/pyanaconda/network.py
index 304b1c0..70b9fa6 100644
--- a/pyanaconda/network.py
+++ b/pyanaconda/network.py
@@ -146,6 +146,16 @@ def sanityCheckIPString(ip_string):
     except socket.error:
         raise IPError, errstr
 
+def nmIsConnected(state):
+    if int(state) == isys.NM_STATE_CONNECTED_LOCAL:
+        return True
+    elif int(state) == isys.NM_STATE_CONNECTED_SITE:
+        return True
+    elif int(state) == isys.NM_STATE_CONNECTED_GLOBAL:
+        return True
+
+    return False
+
 def hasActiveNetDev():
     try:
         bus = dbus.SystemBus()
@@ -153,10 +163,7 @@ def hasActiveNetDev():
         props = dbus.Interface(nm, isys.DBUS_PROPS_IFACE)
         state = props.Get(isys.NM_SERVICE, "State")
 
-        if int(state) == isys.NM_STATE_CONNECTED:
-            return True
-        else:
-            return False
+        return nmIsConnected(state)
     except:
         return False
 
@@ -793,13 +800,13 @@ class Network:
         i = 0
         while i < CONNECTION_TIMEOUT:
             state = props.Get(isys.NM_SERVICE, "State")
-            if int(state) == isys.NM_STATE_CONNECTED:
+            if nmIsConnected(state):
                 return True
             i += 1
             time.sleep(1)
 
         state = props.Get(isys.NM_SERVICE, "State")
-        if int(state) == isys.NM_STATE_CONNECTED:
+        if nmIsConnected(state):
             return True
 
         return False

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux