From 6eadbfb1f3f31357fae70a514b61674b29229350 Mon Sep 17 00:00:00 2001 From: pcarrier Date: Fri, 19 Nov 2010 14:22:13 +0000 Subject: General cleanup in modules More consistent code and some cleanup, mostly: - Using "from os.path import exists" for shorter expressions. - no more useless if:return True;else:return False in checkenabled() I expect to stay. git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@1011 ef72aa8b-4018-0410-8976-d6e080ef94d8 --- sos/plugins/abrt.py | 8 +++----- sos/plugins/amd.py | 7 +++---- sos/plugins/anaconda.py | 6 ++---- sos/plugins/cobbler.py | 5 +---- sos/plugins/ftp.py | 7 +++---- sos/plugins/ipa.py | 6 ++---- sos/plugins/ipsec.py | 4 +--- sos/plugins/kdump.py | 4 +--- sos/plugins/kvm.py | 4 +--- sos/plugins/mysql.py | 12 ++++++------ sos/plugins/netdump.py | 4 +--- sos/plugins/nfsserver.py | 1 - sos/plugins/nscd.py | 4 +--- sos/plugins/oddjob.py | 6 ++---- sos/plugins/openssl.py | 7 +++---- sos/plugins/openswan.py | 6 ++---- sos/plugins/postfix.py | 6 ++---- sos/plugins/ppp.py | 6 ++---- sos/plugins/pxe.py | 6 ++---- sos/plugins/qpidd.py | 5 +---- sos/plugins/quagga.py | 5 ++--- sos/plugins/radius.py | 6 ++---- sos/plugins/rhn.py | 7 +------ sos/plugins/s390.py | 5 +---- sos/plugins/sar.py | 10 ++++------ sos/plugins/selinux.py | 1 - sos/plugins/sendmail.py | 7 ++----- sos/plugins/smartcard.py | 4 +--- sos/plugins/snmp.py | 6 ++---- sos/plugins/sssd.py | 4 +--- sos/plugins/tftpserver.py | 4 +--- sos/plugins/tomcat.py | 6 ++---- sos/plugins/veritas.py | 9 +++------ sos/plugins/vmware.py | 8 +++----- sos/plugins/x11.py | 12 +++--------- sos/plugins/xen.py | 4 +--- sos/plugins/xinetd.py | 4 +--- 37 files changed, 69 insertions(+), 147 deletions(-) diff --git a/sos/plugins/abrt.py b/sos/plugins/abrt.py index 5108dfbb..55f2a9d4 100644 --- a/sos/plugins/abrt.py +++ b/sos/plugins/abrt.py @@ -15,7 +15,7 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import sos.plugintools -import os +from os.path import exists class abrt(sos.plugintools.PluginBase): """ABRT log dump @@ -24,10 +24,8 @@ class abrt(sos.plugintools.PluginBase): optionList = [("backtraces", 'collect backtraces for every report', 'slow', False)] def checkenabled(self): - if self.isInstalled("abrt-cli") or \ - os.path.exists("/var/spool/abrt"): - return True - return False + return self.isInstalled("abrt-cli") or \ + exists("/var/spool/abrt") def do_backtraces(self): ret, output, rtime = self.callExtProg('/usr/bin/sqlite3 /var/spool/abrt/abrt-db \'select UUID from abrt_v4\'') diff --git a/sos/plugins/amd.py b/sos/plugins/amd.py index d2e85f09..a3bc6602 100644 --- a/sos/plugins/amd.py +++ b/sos/plugins/amd.py @@ -15,15 +15,14 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import sos.plugintools -import os +from os.path import exists class amd(sos.plugintools.PluginBase): """Amd automounter information """ + def checkenabled(self): - if self.isInstalled("am-utils") or os.path.exists("/etc/rc.d/init.d/amd"): - return True - return False + return self.isInstalled("am-utils") or exists("/etc/rc.d/init.d/amd") def setup(self): self.addCopySpec("/etc/amd.*") diff --git a/sos/plugins/anaconda.py b/sos/plugins/anaconda.py index 27132fb2..8c8c3f0c 100644 --- a/sos/plugins/anaconda.py +++ b/sos/plugins/anaconda.py @@ -13,15 +13,13 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import sos.plugintools -import os +from os.path import exists class anaconda(sos.plugintools.PluginBase): """Anaconda / Installation information """ def checkenabled(self): - if os.path.exists("/var/log/anaconda.log"): - return True - return False + return exists("/var/log/anaconda.log") def setup(self): self.addCopySpec("/root/anaconda-ks.cfg") diff --git a/sos/plugins/cobbler.py b/sos/plugins/cobbler.py index d35a0b8d..11ff8499 100644 --- a/sos/plugins/cobbler.py +++ b/sos/plugins/cobbler.py @@ -13,15 +13,12 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import sos.plugintools -import os class cobbler(sos.plugintools.PluginBase): """cobbler related information """ def checkenabled(self): - if self.isInstalled("cobbler"): - return True - return False + return self.isInstalled("cobbler") def setup(self): self.addCopySpec("/etc/cobbler") diff --git a/sos/plugins/ftp.py b/sos/plugins/ftp.py index 5bed5667..41aeb385 100644 --- a/sos/plugins/ftp.py +++ b/sos/plugins/ftp.py @@ -13,15 +13,14 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import sos.plugintools -import os +from os.path import returns class ftp(sos.plugintools.PluginBase): """FTP server related information """ + def checkenabled(self): - if self.isInstalled("vsftpd") or os.path.exists("/etc/vsftpd"): - return True - return False + return self.isInstalled("vsftpd") or exists("/etc/vsftpd") def setup(self): self.addCopySpec("/etc/ftp*") diff --git a/sos/plugins/ipa.py b/sos/plugins/ipa.py index 2c6ca9b6..2e13db20 100644 --- a/sos/plugins/ipa.py +++ b/sos/plugins/ipa.py @@ -15,7 +15,7 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import sos.plugintools -import os +from os.path import exists class ipa(sos.plugintools.PluginBase): """IPA diagnostic information @@ -24,9 +24,7 @@ class ipa(sos.plugintools.PluginBase): # need to get kerberos and ipa specific addons. def checkenabled(self): - if self.isInstalled("ipa-server") or os.path.exists("/etc/ipa"): - return True - return False + return self.isInstalled("ipa-server") or exists("/etc/ipa"): def setup(self): self.addCopySpec("/etc/dirsrv/ds.keytab") diff --git a/sos/plugins/ipsec.py b/sos/plugins/ipsec.py index 87671b87..e4d2f7ae 100644 --- a/sos/plugins/ipsec.py +++ b/sos/plugins/ipsec.py @@ -21,9 +21,7 @@ class ipsec(sos.plugintools.PluginBase): """ipsec related information """ def checkenabled(self): - if self.isInstalled("ipsec-tools") or exists("/etc/racoon/racoon.conf"): - return True - return False + return self.isInstalled("ipsec-tools") or exists("/etc/racoon/racoon.conf") def setup(self): self.addCopySpec("/etc/racoon") diff --git a/sos/plugins/kdump.py b/sos/plugins/kdump.py index d9f248a4..6aacefca 100644 --- a/sos/plugins/kdump.py +++ b/sos/plugins/kdump.py @@ -19,9 +19,7 @@ class kdump(sos.plugintools.PluginBase): """Kdump related information """ def checkenabled(self): - if self.isInstalled("kexec-tools") or exists("/etc/kdump.conf"): - return True - return False + return self.isInstalled("kexec-tools") or exists("/etc/kdump.conf") def setup(self): self.addCopySpec("/etc/kdump.conf") diff --git a/sos/plugins/kvm.py b/sos/plugins/kvm.py index 83754db4..c6cbfcef 100644 --- a/sos/plugins/kvm.py +++ b/sos/plugins/kvm.py @@ -25,9 +25,7 @@ class kvm(sos.plugintools.PluginBase): optionList = [("topOutput", '5x iterations of top data', 'slow', False)] def checkenabled(self): - if os.access("/sys/module/kvm", os.R_OK): - return True - return False + return os.access("/sys/module/kvm", os.R_OK) def setup(self): if not os.path.ismount("/sys/kernel/debug"): diff --git a/sos/plugins/mysql.py b/sos/plugins/mysql.py index 3f8dc2bd..22cb6cb0 100644 --- a/sos/plugins/mysql.py +++ b/sos/plugins/mysql.py @@ -13,17 +13,17 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import sos.plugintools -import os +from os.path import exists class mysql(sos.plugintools.PluginBase): """MySQL related information """ + def checkenabled(self): - if self.cInfo["policy"].pkgByName("mysql-server") or os.path.exists("/etc/my.cnf") or \ - self.cInfo["policy"].pkgByName("mysql"): - return True - return False - + return self.isInstalled("mysql-server") or \ + exists("/etc/my.cnf") or \ + self.isInstalled("mysql") + def setup(self): self.addCopySpec("/etc/my.cnf") self.addCopySpec("/etc/sysconfig/network") diff --git a/sos/plugins/netdump.py b/sos/plugins/netdump.py index d57431b8..abe13a07 100644 --- a/sos/plugins/netdump.py +++ b/sos/plugins/netdump.py @@ -19,9 +19,7 @@ class netdump(sos.plugintools.PluginBase): """Netdump Configuration Information """ def checkenabled(self): - if self.isInstalled("netdump") or exists("/etc/sysconfig/netdump*"): - return True - return False + return self.isInstalled("netdump") or exists("/etc/sysconfig/netdump*") def setup(self): self.addCopySpec("/etc/sysconfig/netdump") diff --git a/sos/plugins/nfsserver.py b/sos/plugins/nfsserver.py index 53391463..2a3c3af5 100644 --- a/sos/plugins/nfsserver.py +++ b/sos/plugins/nfsserver.py @@ -41,4 +41,3 @@ class nfsserver(sos.plugintools.PluginBase): self.collectExtOutput("/usr/sbin/rpcinfo -p localhost") self.collectExtOutput("/usr/sbin/nfsstat -a") return - diff --git a/sos/plugins/nscd.py b/sos/plugins/nscd.py index c79afe73..ee9f2e25 100644 --- a/sos/plugins/nscd.py +++ b/sos/plugins/nscd.py @@ -25,9 +25,7 @@ class nscd(sos.plugintools.PluginBase): "", 50)] def checkenabled(self): - if self.cInfo["policy"].pkgByName("nscd") or exists("/etc/nscd.conf"): - return True - return False + return self.isInstalled("nscd") or exists("/etc/nscd.conf") def setup(self): self.addCopySpec("/etc/nscd.conf") diff --git a/sos/plugins/oddjob.py b/sos/plugins/oddjob.py index 13e3049a..64d40784 100644 --- a/sos/plugins/oddjob.py +++ b/sos/plugins/oddjob.py @@ -15,15 +15,13 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import sos.plugintools -import os +from os.path import exists class oddjob(sos.plugintools.PluginBase): """oddjob related information """ def checkenabled(self): - if self.cInfo["policy"].pkgByName("oddjob") or os.path.exists("/etc/oddjobd.conf"): - return True - return False + return self.isInstalled("oddjob") or exists("/etc/oddjobd.conf") def setup(self): self.addCopySpec("/etc/oddjobd.conf") diff --git a/sos/plugins/openssl.py b/sos/plugins/openssl.py index 6d799904..629f3d7b 100644 --- a/sos/plugins/openssl.py +++ b/sos/plugins/openssl.py @@ -15,15 +15,14 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import sos.plugintools -import os +from os.path import exists class openssl(sos.plugintools.PluginBase): """openssl related information """ + def checkenabled(self): - if self.cInfo["policy"].pkgByName("openssl") or os.path.exists("/etc/pki/tls/openssl.cnf"): - return True - return False + return self.isInstalled("openssl") or exists("/etc/pki/tls/openssl.cnf") def setup(self): self.addCopySpec("/etc/pki/tls/openssl.cnf") diff --git a/sos/plugins/openswan.py b/sos/plugins/openswan.py index 4c119807..f9c416bd 100644 --- a/sos/plugins/openswan.py +++ b/sos/plugins/openswan.py @@ -15,15 +15,13 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import sos.plugintools -import os +from os.path import exists class openswan(sos.plugintools.PluginBase): """ipsec related information """ def checkenabled(self): - if self.isInstalled("openswan") or os.path.exists("/etc/ipsec.conf"): - return True - return False + return self.isInstalled("openswan") or exists("/etc/ipsec.conf") def setup(self): self.addCopySpec("/etc/ipsec.conf") diff --git a/sos/plugins/postfix.py b/sos/plugins/postfix.py index 9ab78b2a..7b1e1808 100644 --- a/sos/plugins/postfix.py +++ b/sos/plugins/postfix.py @@ -19,10 +19,8 @@ class postfix(sos.plugintools.PluginBase): """mail server related information """ def checkenabled(self): - if self.isInstalled("postfix") or exists("/etc/rc.d/init.d/postfix"): - return True - return False - + return self.isInstalled("postfix") or exists("/etc/rc.d/init.d/postfix") + def setup(self): self.addCopySpec("/etc/mail") self.addCopySpec("/etc/postfix/main.cf") diff --git a/sos/plugins/ppp.py b/sos/plugins/ppp.py index a60517e2..f2129141 100644 --- a/sos/plugins/ppp.py +++ b/sos/plugins/ppp.py @@ -15,15 +15,13 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import sos.plugintools -import os +from os.path import exists class ppp(sos.plugintools.PluginBase): """ppp, wvdial and rp-pppoe related information """ def checkenabled(self): - if self.cInfo["policy"].pkgByName("ppp") or os.path.exists("/etc/wvdial.conf"): - return True - return False + return self.isInstalled("ppp") or exists("/etc/wvdial.conf") def setup(self): self.addCopySpec("/etc/wvdial.conf") diff --git a/sos/plugins/pxe.py b/sos/plugins/pxe.py index 81e581c6..67af6f97 100644 --- a/sos/plugins/pxe.py +++ b/sos/plugins/pxe.py @@ -13,7 +13,7 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import sos.plugintools -import os +from os.path import exists class pxe(sos.plugintools.PluginBase): """PXE related information @@ -22,9 +22,7 @@ class pxe(sos.plugintools.PluginBase): optionList = [("tftpboot", 'gathers content in /tftpboot', 'slow', False)] def checkenabled(self): - if self.cInfo["policy"].pkgByName("system-config-netboot-cmd") or os.path.exists("/usr/sbin/pxeos"): - return True - return False + return self.isInstalled("system-config-netboot-cmd") or exists("/usr/sbin/pxeos") def setup(self): self.collectExtOutput("/usr/sbin/pxeos -l") diff --git a/sos/plugins/qpidd.py b/sos/plugins/qpidd.py index 08473a03..d5d768a7 100644 --- a/sos/plugins/qpidd.py +++ b/sos/plugins/qpidd.py @@ -19,10 +19,7 @@ class qpidd(sos.plugintools.PluginBase): """ def checkenabled(self): """ checks if mrg enabled """ - if self.cInfo["policy"].pkgByName("qpidd") and \ - self.cInfo["policy"].pkgByName("python-qpid"): - return True - return False + return self.isInstalled("qpidd") and self.isInstalled("python-qpid") def setup(self): """ performs data collection for mrg """ diff --git a/sos/plugins/quagga.py b/sos/plugins/quagga.py index 8e51497a..19216eeb 100644 --- a/sos/plugins/quagga.py +++ b/sos/plugins/quagga.py @@ -20,10 +20,9 @@ from os.path import exists class quagga(sos.plugintools.PluginBase): """quagga related information """ + def checkenabled(self): - if self.cInfo["policy"].pkgByName("quagga") or exists("/etc/quagga/zebra.conf"): - return True - return False + return self.isInstalled("quagga") or exists("/etc/quagga/zebra.conf") def setup(self): self.addCopySpec("/etc/quagga/") diff --git a/sos/plugins/radius.py b/sos/plugins/radius.py index b5015c71..f58f8892 100644 --- a/sos/plugins/radius.py +++ b/sos/plugins/radius.py @@ -15,15 +15,13 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import sos.plugintools -import os +from os.path import exists class radius(sos.plugintools.PluginBase): """radius related information """ def checkenabled(self): - if self.isInstalled("freeradius") or os.path.exists("/etc/raddb"): - return True - return False + return self.isInstalled("freeradius") or exists("/etc/raddb") def setup(self): self.addCopySpec("/etc/raddb") diff --git a/sos/plugins/rhn.py b/sos/plugins/rhn.py index 300524be..60e2479e 100644 --- a/sos/plugins/rhn.py +++ b/sos/plugins/rhn.py @@ -26,8 +26,6 @@ class rhn(sos.plugintools.PluginBase): return False def checkenabled(self): - # enable if any related package is installed - self.satellite = self.isInstalled("rhns-satellite-tools") \ or self.isInstalled("spacewalk-proxy-management" \ # 5.3+ or self.isInstalled("rhn-proxy-management") # pre-5.3 @@ -35,10 +33,7 @@ class rhn(sos.plugintools.PluginBase): or self.isInstalled("spacewalk-java") \ # 5.3+ or self.isInstalled("rhn-base") # pre-5.3 - if self.satellite or self.proxy: - return True - - return False + return self.satellite or self.proxy def setup(self): self.addCopySpec("/etc/httpd/conf*") diff --git a/sos/plugins/s390.py b/sos/plugins/s390.py index f1707d73..abec9107 100644 --- a/sos/plugins/s390.py +++ b/sos/plugins/s390.py @@ -25,10 +25,7 @@ class s390(sos.plugintools.PluginBase): ### Check for s390 arch goes here def checkenabled(self): - sysArch = self.policy().getArch() - if "s390" in sysArch: - return True - return False + return (self.policy().getArch() == "s390") ### Gather s390 specific information diff --git a/sos/plugins/sar.py b/sos/plugins/sar.py index 5867f10b..99e702c0 100644 --- a/sos/plugins/sar.py +++ b/sos/plugins/sar.py @@ -13,14 +13,15 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import sos.plugintools -import os +from os import listdir +from os.path import exists class sar(sos.plugintools.PluginBase): """Generate the sar file from /var/log/sa/saXX files """ def setup(self): path="/var/log/sa" - dirList=os.listdir(path) + dirList=listdir(path) # find all the sa file that don't have an existing sar file for fname in dirList: if fname[0:2] == 'sa' and fname[2] != 'r': @@ -31,7 +32,4 @@ class sar(sos.plugintools.PluginBase): return def checkenabled(self): - if os.path.exists("/var/log/sa") and os.path.exists("/usr/bin/sar"): - return True - return False - + return exists("/var/log/sa") and os.path.exists("/usr/bin/sar") diff --git a/sos/plugins/selinux.py b/sos/plugins/selinux.py index 7ca70712..1e01db23 100644 --- a/sos/plugins/selinux.py +++ b/sos/plugins/selinux.py @@ -29,7 +29,6 @@ class selinux(sos.plugintools.PluginBase): return def checkenabled(self): - # is selinux enabled ? try: if self.collectOutputNow("/usr/sbin/sestatus", root_symlink = "sestatus").split(":")[1].strip() == "disabled": return False diff --git a/sos/plugins/sendmail.py b/sos/plugins/sendmail.py index 56ea2e7a..2e839519 100644 --- a/sos/plugins/sendmail.py +++ b/sos/plugins/sendmail.py @@ -15,18 +15,15 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import sos.plugintools -import os +from os.path import exists class sendmail(sos.plugintools.PluginBase): """sendmail information """ def checkenabled(self): - if self.isInstalled("sendmail") or os.path.exists("/etc/rc.d/init.d/sendmail"): - return True - return False + return self.isInstalled("sendmail") or exists("/etc/rc.d/init.d/sendmail") def setup(self): self.addCopySpec("/etc/mail/*") self.addCopySpec("/var/log/maillog") return - diff --git a/sos/plugins/smartcard.py b/sos/plugins/smartcard.py index f1eb8a96..3f373356 100644 --- a/sos/plugins/smartcard.py +++ b/sos/plugins/smartcard.py @@ -23,9 +23,7 @@ class smartcard(sos.plugintools.PluginBase): """ def checkenabled(self): - if self.isInstalled("pam_pkcs11") or os.path.exists("/etc/pam_pkcs11/pam_pkcs11.conf"): - return True - return False + return self.isInstalled("pam_pkcs11") or os.path.exists("/etc/pam_pkcs11/pam_pkcs11.conf") def setup(self): self.addCopySpec("/etc/reader.conf") diff --git a/sos/plugins/snmp.py b/sos/plugins/snmp.py index c9be4b2f..c559cede 100644 --- a/sos/plugins/snmp.py +++ b/sos/plugins/snmp.py @@ -15,15 +15,13 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import sos.plugintools -import os +from os.path import exists class snmp(sos.plugintools.PluginBase): """snmp related information """ def checkenabled(self): - if self.cInfo["policy"].pkgByName("net-snmp") or os.path.exists("/etc/snmp/snmpd.conf"): - return True - return False + return self.isInstalled("net-snmp") or exists("/etc/snmp/snmpd.conf") def setup(self): self.addCopySpec("/etc/snmp") diff --git a/sos/plugins/sssd.py b/sos/plugins/sssd.py index ecccf424..5bb83734 100644 --- a/sos/plugins/sssd.py +++ b/sos/plugins/sssd.py @@ -32,9 +32,7 @@ class sssd(sos.plugintools.PluginBase): """ def checkenabled(self): - if self.isInstalled("sssd"): - return True - return False + return self.isInstalled("sssd") def setup(self): self.addCopySpec("/etc/sssd") diff --git a/sos/plugins/tftpserver.py b/sos/plugins/tftpserver.py index 0056d221..af7e8e28 100644 --- a/sos/plugins/tftpserver.py +++ b/sos/plugins/tftpserver.py @@ -21,9 +21,7 @@ class tftpserver(sos.plugintools.PluginBase): """tftpserver related information """ def checkenabled(self): - if self.cInfo["policy"].pkgByName("tftp-server") or exists("/etc/xinetd.d/tftp"): - return True - return False + return self.isInstalled("tftp-server") or exists("/etc/xinetd.d/tftp") def setup(self): self.collectExtOutput("/bin/ls -laR /tftpboot") diff --git a/sos/plugins/tomcat.py b/sos/plugins/tomcat.py index a6dc9055..4e52a1fe 100644 --- a/sos/plugins/tomcat.py +++ b/sos/plugins/tomcat.py @@ -18,10 +18,8 @@ class tomcat(sos.plugintools.PluginBase): """Tomcat related information """ def checkenabled(self): - if self.cInfo["policy"].pkgByName("tomcat5"): - return True - return False - + return self.isInstalled("tomcat5") + def setup(self): self.addCopySpec("/etc/tomcat5") self.addCopySpec("/var/log/tomcat5") diff --git a/sos/plugins/veritas.py b/sos/plugins/veritas.py index 53ae030f..7a3eaadd 100644 --- a/sos/plugins/veritas.py +++ b/sos/plugins/veritas.py @@ -16,17 +16,15 @@ import sos.plugintools import os class veritas(sos.plugintools.PluginBase): - """veritas related information + """Veritas related information """ # Information about VRTSexplorer obtained from # http://seer.entsupport.symantec.com/docs/243150.htm optionList = [("script", "Define VRTSexplorer script path", "", "/opt/VRTSspt/VRTSexplorer")] def checkenabled(self): - if os.path.isfile(self.getOption("script")): - return True - return False - + return os.path.isfile(self.getOption("script")) + def setup(self): """ interface with vrtsexplorer to capture veritas related data """ stat, out, runtime = self.callExtProg(self.getOption("script")) @@ -40,4 +38,3 @@ class veritas(sos.plugintools.PluginBase): self.addAlert(e) return return - diff --git a/sos/plugins/vmware.py b/sos/plugins/vmware.py index 7891576d..6b80cb50 100644 --- a/sos/plugins/vmware.py +++ b/sos/plugins/vmware.py @@ -13,16 +13,14 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import sos.plugintools -import os +from os.path import exists class vmware(sos.plugintools.PluginBase): """VMWare related information """ def checkenabled(self): - if os.path.exists("/usr/bin/vmware"): - return True - return False - + return exists("/usr/bin/vmware") + def setup(self): self.collectExtOutput("/usr/bin/vmware -v") self.addCopySpec("/etc/vmware/locations") diff --git a/sos/plugins/x11.py b/sos/plugins/x11.py index 09b7c3c9..15ea0455 100644 --- a/sos/plugins/x11.py +++ b/sos/plugins/x11.py @@ -13,16 +13,13 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import sos.plugintools -import os +from os.path import exists class x11(sos.plugintools.PluginBase): """X related information """ def checkenabled(self): - try:os.stat("/etc/X11") - except:pass - else:return True - return False + return exists("/etc/X11") def setup(self): self.addCopySpec("/etc/X11") @@ -33,9 +30,6 @@ class x11(sos.plugintools.PluginBase): self.addForbiddenPath("/etc/X11/X") self.addForbiddenPath("/etc/X11/fontpath.d") - # TODO: if there is a need for kde that can be added here as well - if os.path.exists("/etc/gdm"): - self.addCopySpec("/etc/gdm") + self.addCopySpec("/etc/gdm") return - diff --git a/sos/plugins/xen.py b/sos/plugins/xen.py index 6a853765..8256f932 100644 --- a/sos/plugins/xen.py +++ b/sos/plugins/xen.py @@ -35,9 +35,7 @@ class xen(sos.plugintools.PluginBase): return "baremetal" def checkenabled(self): - if self.determineXenHost() == "baremetal": - return False - return True + return (self.determineXenHost() == "baremetal") def is_running_xenstored(self): xs_pid = os.popen("pidof xenstored").read() diff --git a/sos/plugins/xinetd.py b/sos/plugins/xinetd.py index b131f165..fc0dce22 100644 --- a/sos/plugins/xinetd.py +++ b/sos/plugins/xinetd.py @@ -21,9 +21,7 @@ class xinetd(sos.plugintools.PluginBase): """xinetd information """ def checkenabled(self): - if self.isInstalled("xinetd") or os.path.exists("/etc/xinetd.conf"): - return True - return False + return self.isInstalled("xinetd") or os.path.exists("/etc/xinetd.conf") def setup(self): self.addCopySpec("/etc/xinetd.conf") -- cgit