summaryrefslogtreecommitdiffstats
path: root/isys/isys.py
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2008-09-15 14:55:36 -1000
committerDavid Cantrell <dcantrell@redhat.com>2008-09-15 14:55:36 -1000
commit838a9442a75d5b6c7e6cb8813b4999780925ad0c (patch)
tree89acd832be43800ac730e3dcc3ed0bcc302e33fb /isys/isys.py
parent1bc0e782a381b51adb0070ea5d31ed418e0d85ba (diff)
downloadanaconda-838a9442a75d5b6c7e6cb8813b4999780925ad0c.tar.gz
anaconda-838a9442a75d5b6c7e6cb8813b4999780925ad0c.tar.xz
anaconda-838a9442a75d5b6c7e6cb8813b4999780925ad0c.zip
Write out final ifcfg-DEVICE files correctly.
Make sure we carry over the settings from the ifcfg-DEVICE files and current device states from NetworkManager.
Diffstat (limited to 'isys/isys.py')
-rwxr-xr-xisys/isys.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/isys/isys.py b/isys/isys.py
index 40fb67594..61521b997 100755
--- a/isys/isys.py
+++ b/isys/isys.py
@@ -948,6 +948,41 @@ def getDeviceProperties(dev=None):
else:
return None
+# Return true if method is currently 'dhcp' for the specified device.
+def isDeviceDHCP(dev=None):
+ if dev is None:
+ return False
+
+ bus = dbus.SystemBus()
+ nm = bus.get_object(NM_SERVICE, NM_MANAGER_PATH)
+ nm_props_iface = dbus.Interface(nm, DBUS_PROPS_IFACE)
+ active_connections = nm_props_iface.Get(NM_MANAGER_IFACE, "ActiveConnections")
+
+ for path in active_connections:
+ active = bus.get_object(NM_SERVICE, path)
+ active_props_iface = dbus.Interface(active, DBUS_PROPS_IFACE)
+
+ active_service_name = active_props_iface.Get(NM_ACTIVE_CONNECTION_IFACE, "ServiceName")
+ active_path = active_props_iface.Get(NM_ACTIVE_CONNECTION_IFACE, "Connection")
+ active_devices = active_props_iface.Get(NM_ACTIVE_CONNECTION_IFACE, "Devices")
+
+ device = bus.get_object(NM_SERVICE, active_devices[0])
+ device_props_iface = dbus.Interface(device, DBUS_PROPS_IFACE)
+ iface = device_props_iface.Get(NM_DEVICE_IFACE, "Interface")
+
+ if iface != dev:
+ continue
+
+ connection = bus.get_object(active_service_name, active_path)
+ connection_iface = dbus.Interface(connection, NM_CONNECTION_IFACE)
+ settings = connection_iface.GetSettings()
+
+ ip4_setting = settings['ipv4']
+ if not ip4_setting or not ip4_setting['method'] or ip4_setting['method'] == 'auto':
+ return True
+
+ return False
+
# Get the MAC address for a network device.
def getMacAddress(dev):
if dev == '' or dev is None: