[PATCH 10/22] A bit lame ifcfg files logging (#520146)

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

 



You can disregard this patch if you find it horrible.
I haven't thought about something that would fit better into
our logging system yet.
---
 gui.py     |    2 ++
 network.py |   24 ++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/gui.py b/gui.py
index 307f5dc..6d7ecc9 100755
--- a/gui.py
+++ b/gui.py
@@ -976,7 +976,9 @@ class InstallInterface(InstallInterfaceBase):
             if not just_setup:
                 self.anaconda.network.updateActiveDevices([install_device])
 
+            network.logIfcfgFiles(header="========== before nm-c-e run\n")
             runNMCE(self.anaconda)
+            network.logIfcfgFiles(header="========== after nm-c-e run\n")
 
             self.anaconda.network.update()
 
diff --git a/network.py b/network.py
index 9bbb935..a7c474e 100644
--- a/network.py
+++ b/network.py
@@ -238,6 +238,30 @@ def getActiveNetDevs():
     ret.sort()
     return ret
 
+def logIfcfgFile(path, header="\n"):
+    logfile = ifcfgLogFile
+    try:
+        f = open(path, 'r')
+    except OSError as e:
+        log.warning("Exception while opening file %s: %s" % (path, str(e)))
+        return
+    lf = open(logfile, 'a')
+    lf.write(header)
+    lf.write(f.read())
+    lf.close()
+    f.close()
+
+def logIfcfgFiles(header="\n"):
+
+    lf = open(ifcfgLogFile, 'a')
+    lf.write(header)
+    lf.close()
+
+    devprops = isys.getDeviceProperties(dev=None)
+    for device in devprops:
+        path = "%s/ifcfg-%s" % (netscriptsDir, device)
+        logIfcfgFile(path, "===== %s\n" % (path,))
+
 class NetworkDevice(IfcfgFile):
 
     def __init__(self, dir, iface, logfile='/tmp/ifcfg.log'):
-- 
1.6.0.6

_______________________________________________
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