diff options
author | Louis Bouchard <louis.bouchard@canonical.com> | 2013-04-03 17:50:55 +0200 |
---|---|---|
committer | Louis Bouchard <louis.bouchard@canonical.com> | 2013-04-05 12:20:40 +0200 |
commit | f4084bab912b41065270301c7305e65df9ddb73c (patch) | |
tree | 15936089f5510081017ee1b607ed8de7ba48968e | |
parent | 1a989a63de99e2f9e2985d16ffa609a13555cfe5 (diff) | |
download | sos-f4084bab912b41065270301c7305e65df9ddb73c.tar.gz |
Enabled new Debian plugins & adapted to new format
-rw-r--r-- | sos/plugins/auditd.py | 4 | ||||
-rw-r--r-- | sos/plugins/corosync.py | 25 | ||||
-rw-r--r-- | sos/plugins/dovecot.py | 26 | ||||
-rw-r--r-- | sos/plugins/ldap.py | 44 | ||||
-rw-r--r-- | sos/plugins/logrotate.py | 4 | ||||
-rw-r--r-- | sos/plugins/lsbrelease.py | 4 |
6 files changed, 94 insertions, 13 deletions
diff --git a/sos/plugins/auditd.py b/sos/plugins/auditd.py index 41bd8605..e15c0a60 100644 --- a/sos/plugins/auditd.py +++ b/sos/plugins/auditd.py @@ -12,9 +12,9 @@ ## along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -from sos.plugins import Plugin, RedHatPlugin +from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin -class auditd(Plugin, RedHatPlugin): +class auditd(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): """Auditd related information """ diff --git a/sos/plugins/corosync.py b/sos/plugins/corosync.py index b02d99a6..eecbde5b 100644 --- a/sos/plugins/corosync.py +++ b/sos/plugins/corosync.py @@ -12,13 +12,14 @@ ## along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -from sos.plugins import Plugin, RedHatPlugin +from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin -class corosync(Plugin, RedHatPlugin): +class Corosync(Plugin): """ corosync information """ - files = ('/usr/bin/corosync',) + plugin_name = "corosync" + packages = ('corosync',) def setup(self): @@ -34,3 +35,21 @@ class corosync(Plugin, RedHatPlugin): self.add_cmd_output("/usr/sbin/corosync-objctl -w runtime.blackbox.dump_state=$(date +\%s)") self.add_cmd_output("/usr/sbin/corosync-objctl -w runtime.blackbox.dump_flight_data=$(date +\%s)") self.call_ext_prog("killall -USR2 corosync") + +class RedHatCorosync(Corosync, RedHatPlugin): + """ corosync information for RedHat based distribution + """ + + def setup(self): + super(RedHatCorosync, self).setup() + + files = ('/usr/bin/corosync',) + +class DebianCorosync(Corosync, DebianPlugin, UbuntuPlugin): + """ corosync information for Debian and Ubuntu distributions + """ + + def setup(self): + super(DebianCorosync, self).setup() + + files = ('/usr/sbin/corosync',) diff --git a/sos/plugins/dovecot.py b/sos/plugins/dovecot.py index 534f2e4c..8d2fd3d8 100644 --- a/sos/plugins/dovecot.py +++ b/sos/plugins/dovecot.py @@ -12,13 +12,35 @@ ## along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -from sos.plugins import Plugin, RedHatPlugin +from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin import os -class dovecot(Plugin, RedHatPlugin): +class Dovecot(Plugin): """dovecot server related information """ + + plugin_name = "dovecot" + + def setup(self): + self.addCopySpec("/etc/dovecot*") + self.addCmdOutput("/usr/sbin/dovecot -n") + +class RedHatDovecot(Dovecot, RedHatPlugin): + """dovecot server related information for RedHat based distribution + """ def setup(self): + super(RedHatDovecot, self).setup() + if os.path.exists("/etc/dovecot.conf"): self.add_copy_spec("/etc/dovecot*") self.add_cmd_output("/usr/sbin/dovecot -n") + + files = ('/etc/dovecot.conf',) + +class DebianDovecot(Dovecot, DebianPlugin, UbuntuPlugin): + """dovecot server related information for Debian based distribution + """ + def setup(self): + super(DebianDovecot, self).setup() + + files = ('/etc/dovecot/README',) diff --git a/sos/plugins/ldap.py b/sos/plugins/ldap.py index dff5d625..42f2db3a 100644 --- a/sos/plugins/ldap.py +++ b/sos/plugins/ldap.py @@ -12,16 +12,28 @@ ## along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -from sos.plugins import Plugin, RedHatPlugin +from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin import os -class ldap(Plugin, RedHatPlugin): +class Ldap(Plugin): """LDAP related information """ + plugin_name = "ldap" + + def setup(self): + super(ldap, self).setup() + +class RedHatLdap(Ldap, RedHatPlugin): + """LDAP related information for RedHat based distribution + """ + files = ('/etc/openldap/ldap.conf',) packages = ('openldap', 'nss-pam-ldapd') + def setup(self): + super(RedHatLdap, self).setup() + def get_ldap_opts(self): # capture /etc/openldap/ldap.conf options in dict # FIXME: possibly not hardcode these options in? @@ -40,3 +52,31 @@ class ldap(Plugin, RedHatPlugin): def postproc(self): self.do_file_sub("/etc/ldap.conf", r"(\s*bindpw\s*)\S+", r"\1***") self.do_file_sub("/etc/nslcd.conf", r"(\s*bindpw\s*)\S+", r"\1***") + +class DebianLdap(Ldap, DebianPlugin, UbuntuPlugin): + """LDAP related information for Debian based distribution + """ + + def setup(self): + super(DebianLdap, self).setup() + + files = ('/etc/ldap/ldap.conf',) + packages = ('slapd', 'ldap-utils') + + def get_ldap_opts(self): + # capture /etc/ldap/ldap.conf options in dict + # FIXME: possibly not hardcode these options in? + ldapopts=["URI","BASE","TLS_CACERTDIR"] + results={} + tmplist=[] + for i in ldapopts: + t=self.do_regex_find_all(r"^(%s)\s+(.*)" % i,"/etc/ldap/ldap.conf") + for x in t: + results[x[0]]=x[1].rstrip("\n") + return results + + def setup(self): + self.add_copy_specs(["/etc/ldap/ldap.conf", "/etc/ldap/slapd.d"]) + + def postproc(self): + self.do_file_sub("/etc/ldap/ldap.conf", r"(\s*bindpw\s*)\S+", r"\1***") diff --git a/sos/plugins/logrotate.py b/sos/plugins/logrotate.py index 3ca35243..1886c17c 100644 --- a/sos/plugins/logrotate.py +++ b/sos/plugins/logrotate.py @@ -12,9 +12,9 @@ ## along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -from sos.plugins import Plugin, RedHatPlugin +from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin -class logrotate(Plugin, RedHatPlugin): +class logrotate(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): """logrotate configuration files and debug info """ diff --git a/sos/plugins/lsbrelease.py b/sos/plugins/lsbrelease.py index 055fbcb0..4d576556 100644 --- a/sos/plugins/lsbrelease.py +++ b/sos/plugins/lsbrelease.py @@ -13,10 +13,10 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -from sos.plugins import Plugin, RedHatPlugin +from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin import os -class lsbrelease(Plugin, RedHatPlugin): +class lsbrelease(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): """Linux Standard Base information """ |