---
pyanaconda/network.py | 37 ++++++++++++++++++++++++-------------
pyanaconda/ui/gui/spokes/network.py | 3 ++-
2 files changed, 26 insertions(+), 14 deletions(-)
diff --git a/pyanaconda/network.py b/pyanaconda/network.py
index c9c571b..afe3b56 100644
--- a/pyanaconda/network.py
+++ b/pyanaconda/network.py
@@ -212,13 +212,21 @@ def logIfcfgFile(path, message=""):
f = open(path, 'r')
content = f.read()
f.close()
+ else:
+ content = "file not found"
ifcfglog.debug("%s%s:\n%s" % (message, path, content))
def logIfcfgFiles(message=""):
- devprops = isys.getDeviceProperties(dev=None)
- for device in devprops:
- path = "%s/ifcfg-%s" % (netscriptsDir, device)
- logIfcfgFile(path, message)
+ ifcfglog.debug("content of files (%s):" % message)
+ for name in os.listdir(netscriptsDir):
+ if name.startswith("ifcfg-"):
+ if name == 'ifcfg-lo':
+ continue
+ path = os.path.join(netscriptsDir, name)
+ f = open(path, 'r')
+ content = f.read()
+ f.close()
+ ifcfglog.debug("%s:\n%s" % (path, content))
class NetworkDevice(IfcfgFile):
@@ -276,25 +284,20 @@ class NetworkDevice(IfcfgFile):
self.writeIfcfgFile()
def loadIfcfgFile(self):
- ifcfglog.debug("%s:\n%s" % (self.path, self.fileContent()))
- ifcfglog.debug("NetworkDevice %s:\n%s" % (self.iface, self.__str__()))
- ifcfglog.debug("loadIfcfgFile %s from %s" % (self.iface, self.path))
+ ifcfglog.debug("loadIfcfFile %s" % self.path)
self.clear()
IfcfgFile.read(self)
self._dirty = False
- ifcfglog.debug("NetworkDevice %s:\n%s" % (self.iface, self.__str__()))
-
def writeIfcfgFile(self):
# Write out the file only if there is a key whose
# value has been changed since last load of ifcfg file.
- ifcfglog.debug("%s:\n%s" % (self.path, self.fileContent()))
- ifcfglog.debug("NetworkDevice %s:\n%s" % (self.iface, self.__str__()))
ifcfglog.debug("writeIfcfgFile %s to %s%s" % (self.iface, self.path,
("" if self._dirty else " not needed")))
-
if self._dirty:
+ ifcfglog.debug("old %s:\n%s" % (self.path, self.fileContent()))
+ ifcfglog.debug("writing NetworkDevice %s:\n%s" % (self.iface, self.__str__()))
IfcfgFile.write(self)
self._dirty = False
@@ -424,6 +427,7 @@ def get_NM_object(path):
# Handle default auto connections created by NM upon start
# For server, those will be turned off in NetworkManager.conf
def createMissingDefaultIfcfgs():
+ rv = False
nm = get_NM_object(isys.NM_MANAGER_PATH)
dev_paths = nm.GetDevices()
settings = get_NM_object(isys.NM_SETTINGS_PATH)
@@ -450,10 +454,14 @@ def createMissingDefaultIfcfgs():
if con_hwaddr.upper() == hwaddr.upper():
setting['connection']['id'] = interface
con.Update(setting)
+ rv = True
+ log.debug("network: dumped ifcfg file for default autoconnection on %s" % interface)
break
else:
# if there is no connection, create default ifcfg
device_cfg.setDefaultConfig()
+ rv = True
+ return rv
def getDevices():
# TODO: filter with existence of ifcfg file?
@@ -995,9 +1003,12 @@ def setOnboot(ksdata):
# networking initialization and ksdata object update
def networkInitialize(ksdata):
+ log.debug("network: devices found %s" % getDevices())
+ logIfcfgFiles("network initialization")
if not flags.imageInstall:
# XXX: this should go to anaconda dracut
- createMissingDefaultIfcfgs()
+ if createMissingDefaultIfcfgs():
+ logIfcfgFiles("ifcfgs created")
# we set ONBOOT value using network --activate activate in dracut
# to get devices activated by NM, so set proper ONBOOT value
diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py
index e5b91d5..e8783ce 100644
--- a/pyanaconda/ui/gui/spokes/network.py
+++ b/pyanaconda/ui/gui/spokes/network.py
@@ -41,7 +41,7 @@ from pyanaconda.ui.gui.categories.software import SoftwareCategory
from pyanaconda.ui.gui.hubs.summary import SummaryHub
from pyanaconda.ui.gui.utils import gtk_call_once
-from pyanaconda.network import NetworkDevice, netscriptsDir, kickstartNetworkData, getActiveNetDevs
+from pyanaconda.network import NetworkDevice, netscriptsDir, kickstartNetworkData, getActiveNetDevs, logIfcfgFiles
from gi.repository import GLib, GObject, Pango, Gio, NetworkManager, NMClient
import dbus
@@ -449,6 +449,7 @@ class NetworkControlBox():
if activate:
con, device = activate
gtk_call_once(self._activate_connection_cb, con, device)
+ logIfcfgFiles("nm-c-e run")
def _activate_connection_cb(self, con, device):
self.client.activate_connection(con, device,
--
1.7.11.7