A bit lame ifcfg files logging (#520146)
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 ") runNMCE(self.anaconda) + network.logIfcfgFiles(header="========== after nm-c-e run ") 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=" "): + 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=" "): + + 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 " % (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@redhat.com https://www.redhat.com/mailman/listinfo/anaconda-devel-list |
A bit lame ifcfg files logging (#520146)
-----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 ") runNMCE(self.anaconda) + network.logIfcfgFiles(header="========== after nm-c-e run ") 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=" "): + 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=" "): + + 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 " % (path,)) + class NetworkDevice(IfcfgFile): def __init__(self, dir, iface, logfile='/tmp/ifcfg.log'): - -- David Cantrell <dcantrell@redhat.com> Red Hat / Honolulu, HI -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAkvfjpIACgkQ5hsjjIy1Vkm56gCg6lvo6KlBz9 aP4d1tGi9y8yy4 l5wAoOnwwytD/qouvqnbyq4X5BX7SXUV =qBsy -----END PGP SIGNATURE----- _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@redhat.com https://www.redhat.com/mailman/listinfo/anaconda-devel-list |
A bit lame ifcfg files logging (#520146)
David Cantrell wrote:
-----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. It is logged into separate /tmp/ifcfg.log, so it doesn't polute log files we have. Also I don't think it is using much resources, and it can be pretty handy info that can be asked from bz reporter, it is a source of information about what user set in nm-c-e, so I'd not limit it to debug mode. Radek _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@redhat.com https://www.redhat.com/mailman/listinfo/anaconda-devel-list |
A bit lame ifcfg files logging (#520146)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 On Wed, 5 May 2010, Radek Vykydal wrote: David Cantrell wrote: -----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. It is logged into separate /tmp/ifcfg.log, so it doesn't polute log files we have. Also I don't think it is using much resources, and it can be pretty handy info that can be asked from bz reporter, it is a source of information about what user set in nm-c-e, so I'd not limit it to debug mode. OK, that's fine then. - -- David Cantrell <dcantrell@redhat.com> Red Hat / Honolulu, HI -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAkvi1z8ACgkQ5hsjjIy1Vkn46QCgjMFeduATjY ExaTxeE5Is5iVU qQgAn0m+erZnKYg+A1W1q/61go9HVVgo =L2WW -----END PGP SIGNATURE----- _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@redhat.com https://www.redhat.com/mailman/listinfo/anaconda-devel-list |
| All times are GMT. The time now is 09:24 PM. |
VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.