diff options
author | shnavid <shnavid@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2007-07-27 09:58:38 +0000 |
---|---|---|
committer | shnavid <shnavid@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2007-07-27 09:58:38 +0000 |
commit | 43ff5b0065eb772859f55b4d397b971d2c3a8f90 (patch) | |
tree | 85c3b482d44a9a57782b6437e8938c841fe874f0 /src | |
parent | e0741ee20f93712236d328aa18a2b35f13a5bd75 (diff) | |
download | sos-43ff5b0065eb772859f55b4d397b971d2c3a8f90.tar.gz |
added checkenabled() method to many plugins
bumped release to 2
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@229 ef72aa8b-4018-0410-8976-d6e080ef94d8
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/sos/plugins/amd.py | 6 | ||||
-rw-r--r-- | src/lib/sos/plugins/ftp.py | 6 | ||||
-rw-r--r-- | src/lib/sos/plugins/named.py | 32 | ||||
-rw-r--r-- | src/lib/sos/plugins/nfsserver.py | 14 | ||||
-rw-r--r-- | src/lib/sos/plugins/radius.py | 7 | ||||
-rw-r--r-- | src/lib/sos/plugins/satellite.py | 17 | ||||
-rw-r--r-- | src/lib/sos/plugins/sendmail.py | 6 | ||||
-rw-r--r-- | src/lib/sos/plugins/squid.py | 6 | ||||
-rw-r--r-- | src/lib/sos/plugins/x11.py | 8 | ||||
-rw-r--r-- | src/sos.spec | 2 |
10 files changed, 85 insertions, 19 deletions
diff --git a/src/lib/sos/plugins/amd.py b/src/lib/sos/plugins/amd.py index 1b1375cc..174f850b 100644 --- a/src/lib/sos/plugins/amd.py +++ b/src/lib/sos/plugins/amd.py @@ -15,10 +15,16 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import sos.plugintools +import os class amd(sos.plugintools.PluginBase): """Amd automounter information """ + def checkenabled(self): + if self.cInfo["policy"].pkgByName("am-utils") or os.path.exists("/etc/rc.d/init.d/amd"): + return True + return False + def setup(self): self.addCopySpec("/etc/amd.*") self.addCopySpec("/etc/rc.d/init.d/amd") diff --git a/src/lib/sos/plugins/ftp.py b/src/lib/sos/plugins/ftp.py index 026954c0..c3b8f5c4 100644 --- a/src/lib/sos/plugins/ftp.py +++ b/src/lib/sos/plugins/ftp.py @@ -13,10 +13,16 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import sos.plugintools +import os class ftp(sos.plugintools.PluginBase): """FTP server related information """ + def checkenabled(self): + if self.cInfo["policy"].pkgByName("vsftpd") or os.path.exists("/etc/vsftpd"): + return True + return False + def setup(self): self.addCopySpec("/etc/ftp*") self.addCopySpec("/etc/vsftpd") diff --git a/src/lib/sos/plugins/named.py b/src/lib/sos/plugins/named.py index 68d56ca0..421143cb 100644 --- a/src/lib/sos/plugins/named.py +++ b/src/lib/sos/plugins/named.py @@ -19,18 +19,22 @@ import os class named(sos.plugintools.PluginBase): """named related information """ - def setup(self): - dnsdir = "" - self.addCopySpec("/etc/named.boot") - self.addCopySpec("/etc/named.conf") - self.addCopySpec("/etc/sysconfig/named") - if os.access("/etc/named.conf", os.R_OK): - dnsdir = commands.getoutput("/bin/grep -i directory /etc/named.conf | /bin/gawk '{print $2}' | /bin/sed 's/\\\"//g' | /bin/sed 's/\;//g'") - if os.access("/etc/named.boot", os.R_OK): - dnsdir = commands.getoutput("/bin/grep -i directory /etc/named.boot | /bin/gawk '{print $2}' | /bin/sed 's/\\\"//g' | /bin/sed 's/\;//g'") - if '' != dnsdir.strip(): - self.addCopySpec(dnsdir) - self.addForbiddenPath('/var/named/chroot/proc') - self.addForbiddenPath('/var/named/chroot/dev') - return + def checkenabled(self): + if self.cInfo["policy"].pkgByName("bind") or os.path.exists("/etc/named.conf") or os.path.exists("/etc/sysconfig/named"): + return True + return False + def setup(self): + dnsdir = "" + self.addCopySpec("/etc/named.boot") + self.addCopySpec("/etc/named.conf") + self.addCopySpec("/etc/sysconfig/named") + if os.access("/etc/named.conf", os.R_OK): + dnsdir = commands.getoutput("/bin/grep -i directory /etc/named.conf | /bin/gawk '{print $2}' | /bin/sed 's/\\\"//g' | /bin/sed 's/\;//g'") + if os.access("/etc/named.boot", os.R_OK): + dnsdir = commands.getoutput("/bin/grep -i directory /etc/named.boot | /bin/gawk '{print $2}' | /bin/sed 's/\\\"//g' | /bin/sed 's/\;//g'") + if '' != dnsdir.strip(): + self.addCopySpec(dnsdir) + self.addForbiddenPath('/var/named/chroot/proc') + self.addForbiddenPath('/var/named/chroot/dev') + return diff --git a/src/lib/sos/plugins/nfsserver.py b/src/lib/sos/plugins/nfsserver.py index 6c894177..9564aa22 100644 --- a/src/lib/sos/plugins/nfsserver.py +++ b/src/lib/sos/plugins/nfsserver.py @@ -15,10 +15,24 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import sos.plugintools +import os +from stat import ST_SIZE class nfsserver(sos.plugintools.PluginBase): """NFS server-related information """ + def checkenabled(self): + if self.cInfo["policy"].runlevelDefault() in self.cInfo["policy"].runlevelByService("nfs"): + return True + + try: + if os.stat("/etc/exports")[ST_SIZE] > 0 or os.stat("/var/lib/nfs/xtab")[ST_SIZE] > 0: + return True + except: + pass + + return False + def setup(self): self.addCopySpec("/etc/exports") self.collectExtOutput("/usr/sbin/rpcinfo -p localhost") diff --git a/src/lib/sos/plugins/radius.py b/src/lib/sos/plugins/radius.py index 7ab53810..8c1786e3 100644 --- a/src/lib/sos/plugins/radius.py +++ b/src/lib/sos/plugins/radius.py @@ -15,13 +15,20 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import sos.plugintools +import os class radius(sos.plugintools.PluginBase): """radius related information """ + def checkenabled(self): + if self.cInfo["policy"].pkgByName("freeradius") or os.path.exists("/etc/raddb"): + return True + return False + def setup(self): self.addCopySpec("/etc/raddb") self.addCopySpec("/etc/pam.d/radiusd") + self.addCopySpec("/var/log/radius") return def postproc(self): diff --git a/src/lib/sos/plugins/satellite.py b/src/lib/sos/plugins/satellite.py index 930d11b0..5d0b2b1e 100644 --- a/src/lib/sos/plugins/satellite.py +++ b/src/lib/sos/plugins/satellite.py @@ -19,9 +19,18 @@ class satellite(sos.plugintools.PluginBase): """ def defaultenabled(self): + # enable if any related package is installed + for pkg in [ "rhn-satellite" ]: + if self.cInfo["policy"].pkgByName(pkg) != None: + return True + return False def setup(self): + # made from: + # http://svn.rhndev.redhat.com/viewcvs/branches/eng/RELEASE-5.0.5-dev/backend/satellite_tools/satellite-debug?rev=114478&view=markup + # FIXME: symlinks and directories for copySpec (same as root_symlink for commands) + self.addCopySpec("/etc/httpd/conf") self.addCopySpec("/etc/rhn") self.addCopySpec("/etc/sysconfig/rhn") @@ -35,7 +44,7 @@ class satellite(sos.plugintools.PluginBase): self.addCopySpec("/etc/tomcat5") self.addCopySpec("/var/log/tomcat5") - # all these used to go in $DIR/mon-logs + # all these used to go in $DIR/mon-logs/ self.addCopySpec("/opt/notification/var/*.log*") self.addCopySpec("/var/tmp/ack_handler.log*") self.addCopySpec("/var/tmp/enqueue.log*") @@ -46,8 +55,8 @@ class satellite(sos.plugintools.PluginBase): self.addCopySpec("/var/tmp/enqueue.log*") self.addCopySpec("/root/ssl-build") - self.addCopySpec("rpm -qa --last") # $DIR/rpm-manifest - self.addCopySpec("/usr/bin/rhn-schema-version") # $DIR/database-schema-version - self.addCopySpec("/usr/bin/rhn-charsets") # $DIR/database-character-sets + self.collectExtOutput("rpm -qa --last", root_symlink = "rpm-manifest") + self.collectExtOutput("/usr/bin/rhn-schema-version", root_symlink = "database-schema-version") + self.collectExtOutput("/usr/bin/rhn-charsets", root_symlink = "database-character-sets") return diff --git a/src/lib/sos/plugins/sendmail.py b/src/lib/sos/plugins/sendmail.py index d95b5d7b..79713805 100644 --- a/src/lib/sos/plugins/sendmail.py +++ b/src/lib/sos/plugins/sendmail.py @@ -15,10 +15,16 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import sos.plugintools +import os class sendmail(sos.plugintools.PluginBase): """sendmail information """ + def checkenabled(self): + if self.cInfo["policy"].pkgByName("sendmail") or os.path.exists("/etc/rc.d/init.d/sendmail"): + return True + return False + def setup(self): self.addCopySpec("/etc/mail/*") self.addCopySpec("/var/log/maillog") diff --git a/src/lib/sos/plugins/squid.py b/src/lib/sos/plugins/squid.py index 4544ef9a..fdd3b8cf 100644 --- a/src/lib/sos/plugins/squid.py +++ b/src/lib/sos/plugins/squid.py @@ -13,10 +13,16 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import sos.plugintools +import os class squid(sos.plugintools.PluginBase): """squid related information """ + def checkenabled(self): + if self.cInfo["policy"].pkgByName("squid") != None or os.path.exists("/etc/squid/squid.conf"): + return True + return False + def setup(self): self.addCopySpec("/etc/squid/squid.conf") return diff --git a/src/lib/sos/plugins/x11.py b/src/lib/sos/plugins/x11.py index 9b7b7ac9..4abd8782 100644 --- a/src/lib/sos/plugins/x11.py +++ b/src/lib/sos/plugins/x11.py @@ -13,10 +13,18 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import sos.plugintools +import os class x11(sos.plugintools.PluginBase): """X related information """ + def checkenabled(self): + try: os.stat("/etc/X11") + except: pass + else: return True + + return False + def setup(self): self.addCopySpec("/etc/X11") self.addCopySpec("/var/log/Xorg.*.log") diff --git a/src/sos.spec b/src/sos.spec index 4b4237d7..34423b15 100644 --- a/src/sos.spec +++ b/src/sos.spec @@ -2,7 +2,7 @@ %define name sos %define version 1.7 -%define release 1 +%define release 2 %define _localedir %_datadir/locale |