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

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

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Not horrible, but I'm not crazy about the spurious log file output such as:

    ========== before nm-c-e run

Those entries can stay, but make them log at the DEBUG level.

On Tue, 27 Apr 2010, Radek Vykydal wrote:

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'):


- -- David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkvfjpIACgkQ5hsjjIy1Vkm56gCg6lvo6KlBz9aP4d1tGi9y8yy4
l5wAoOnwwytD/qouvqnbyq4X5BX7SXUV
=qBsy
-----END PGP SIGNATURE-----

_______________________________________________
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