From 75c3d16176aec599f7e3e7c7e44c0afb337d54b7 Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Tue, 11 Dec 2012 17:49:56 +0000 Subject: Remove diagnose() methods from plugins Delete the diagnose() methods from all modules still using it. The diagnostics feature never worked well and is better implemented to run after-the-fact on the data collected in the tarball. --- sos/plugins/kernel.py | 21 --------------------- sos/plugins/ldap.py | 6 ------ sos/plugins/lsbrelease.py | 3 --- sos/plugins/process.py | 27 --------------------------- 4 files changed, 57 deletions(-) diff --git a/sos/plugins/kernel.py b/sos/plugins/kernel.py index 525ecba7..d324f963 100644 --- a/sos/plugins/kernel.py +++ b/sos/plugins/kernel.py @@ -81,27 +81,6 @@ class kernel(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): self.collectExtOutput("/usr/sbin/dkms status") - def diagnose(self): - - infd = open("/proc/modules", "r") - for modname in infd.readlines(): - modname=modname.split(" ")[0] - ret, modinfo_srcver, rtime = self.callExtProg("/sbin/modinfo -F srcversion %s" % modname) - if not os.access("/sys/module/%s/srcversion" % modname, os.R_OK): - continue - infd = open("/sys/module/%s/srcversion" % modname, "r") - sys_srcver = infd.read().strip("\n") - infd.close() - if modinfo_srcver != sys_srcver: - self.addDiagnose("loaded module %s differs from the one present on the file-system" % modname) - - # this would be a good moment to check the module's signature - # but at the moment there's no easy way to do that outside of - # the kernel. i will probably need to write a C lib (derived from - # the kernel sources to do this verification. - - infd.close() - def analyze(self): savedtaint = os.path.join(self.cInfo['dstroot'], "/proc/sys/kernel/tainted") diff --git a/sos/plugins/ldap.py b/sos/plugins/ldap.py index c4a07d26..8daaf18d 100644 --- a/sos/plugins/ldap.py +++ b/sos/plugins/ldap.py @@ -34,12 +34,6 @@ class ldap(Plugin, RedHatPlugin): results[x[0]]=x[1].rstrip("\n") return results - def diagnose(self): - # Validate ldap client options - ldapopts=self.get_ldap_opts() - if ldapopts.has_key("TLS_CACERTDIR") and not os.path.exists(ldapopts["TLS_CACERTDIR"]): - self.addDiagnose("%s does not exist and can cause connection issues involving TLS" % ldapopts["TLS_CACERTDIR"]) - def setup(self): self.addCopySpecs(["/etc/ldap.conf", "/etc/openldap", "/etc/nslcd.conf"]) diff --git a/sos/plugins/lsbrelease.py b/sos/plugins/lsbrelease.py index 782038e1..5d3ca32c 100644 --- a/sos/plugins/lsbrelease.py +++ b/sos/plugins/lsbrelease.py @@ -19,9 +19,6 @@ import os class lsbrelease(Plugin, RedHatPlugin): """Linux Standard Base information """ - def diagnose(self): - if not os.path.exists("/etc/redhat-release"): - self.addDiagnose("/etc/redhat-release missing") def setup(self): self.collectExtOutput("/usr/bin/lsb_release -a") diff --git a/sos/plugins/process.py b/sos/plugins/process.py index 48ec4bd6..ebe2ed4c 100644 --- a/sos/plugins/process.py +++ b/sos/plugins/process.py @@ -29,30 +29,3 @@ class process(Plugin, RedHatPlugin): def find_mountpoint(s): if (os.path.ismount(s) or len(s)==0): return s else: return mountpoint(os.path.split(s)[0]) - - def diagnose(self): - from subprocess import Popen, PIPE - # check that no process is in state D - dpids = [] - p = Popen("/bin/ps -A -o state,pid --no-heading", shell=True, stdout=PIPE, stderr=PIPE, bufsize=-1) - out, err = p.communicate() - if not p.returncode: - for line in out.split("\n")[:-1]: - line = line.split() - if line[0] == "D": - # keep an eye on the process to see if the stat changes - for inc in range(1,10): - try: - if len(self.fileGrep("^State: D", " /proc/%d/status" % int(line[1]))) == 0: - # status is not D, good. let's get out of the loop. - time.sleep(0.1 * inc) - continue - except IOError: - # this should never happen... - pass - else: - # still D after 0.1 * range(1,5) seconds - dpids.append(int(line[1])) - - if len(dpids): - self.addDiagnose("one or more processes are in state D (sosreport might hang)") -- cgit