summaryrefslogtreecommitdiffstats
path: root/network.py
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2008-09-23 21:59:47 -1000
committerDavid Cantrell <dcantrell@redhat.com>2008-09-24 16:09:22 -1000
commit2021524989bc7105208fbfe10234f8f87d47fafb (patch)
treee97ada1cb7e7c1298367de13d3f6f98a356fa0be /network.py
parent8f49499b277fb0a85738b0b60d8eb2fc320de6ad (diff)
downloadanaconda-2021524989bc7105208fbfe10234f8f87d47fafb.tar.gz
anaconda-2021524989bc7105208fbfe10234f8f87d47fafb.tar.xz
anaconda-2021524989bc7105208fbfe10234f8f87d47fafb.zip
Poll 'State' property from NetworkManager in network.bringUp()
After writing new networking settings, check the State property from NetworkManager to see if we are connected. Return True if we ever see state go to connected, False otherwise. Idea here is that the interface code can pop up an error if we get False from this function.
Diffstat (limited to 'network.py')
-rw-r--r--network.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/network.py b/network.py
index 76d8b27fd..e495b7aa8 100644
--- a/network.py
+++ b/network.py
@@ -28,6 +28,7 @@ import isys
import iutil
import socket
import os
+import time
import minihal
import rhpl
import dbus
@@ -621,6 +622,25 @@ class Network:
f.close()
# write out current configuration state and wait for NetworkManager
- # to bring the device up
+ # to bring the device up, watch NM state and return to the caller
+ # once we have a state
def bringUp(self):
self.write()
+
+ bus = dbus.SystemBus()
+ nm = bus.get_object(isys.NM_SERVICE, isys.NM_MANAGER_PATH)
+ props = dbus.Interface(nm, isys.DBUS_PROPS_IFACE)
+
+ i = 45
+ while i < 45:
+ state = props.Get(isys.NM_SERVICE, "State")
+ if int(state) == isys.NM_STATE_CONNECTED:
+ return True
+ i += 1
+ time.sleep(1)
+
+ state = props.Get(isys.NM_SERVICE, "State")
+ if int(state) == isys.NM_STATE_CONNECTED:
+ return True
+
+ return False