diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2013-04-16 07:09:29 -0700 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2013-04-16 07:09:29 -0700 |
commit | d7b6b629abf423ee2e0392e7ef18e6a595724417 (patch) | |
tree | 1d55119100c30a3d7b15e2b521c60384cec1ce94 | |
parent | 40e3b7732b438308377d0f4aa4a5374f9ace4368 (diff) | |
parent | ee8f31756b8a1c9353e32eb90845a24a776be8bd (diff) | |
download | sos-d7b6b629abf423ee2e0392e7ef18e6a595724417.tar.gz |
Merge pull request #124 from arges/master
Add Ubuntu/Debian support for Postgresql.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | sos/plugins/postgresql.py | 39 | ||||
-rw-r--r-- | sos/plugins/soundcard.py | 35 |
3 files changed, 62 insertions, 13 deletions
@@ -1,5 +1,6 @@ Adam Stokes <adam.stokes@ubuntu.com> Ben Turner <bturner@redhat.com> +Chris J Arges <chris.j.arges@ubuntu.com> Eric Williams <eric.williams@canonical.com> Eugene Teo <eteo@redhat.com> Gary Kotton <gkotton@redhat.com> diff --git a/sos/plugins/postgresql.py b/sos/plugins/postgresql.py index 1ae269fb..084d70a7 100644 --- a/sos/plugins/postgresql.py +++ b/sos/plugins/postgresql.py @@ -4,12 +4,14 @@ import shlex import subprocess import tempfile -from sos.plugins import Plugin, RedHatPlugin +from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin from sos.utilities import find -class postgresql(Plugin, RedHatPlugin): +class PostgreSQL(Plugin): """PostgreSQL related information""" + plugin_name = "postgresql" + packages = ('postgresql',) tmp_dir = None @@ -44,6 +46,17 @@ class postgresql(Plugin, RedHatPlugin): else: self.add_alert("WARN: password must be supplied to dump a database.") + def postproc(self): + import shutil + if self.tmp_dir: + shutil.rmtree(self.tmp_dir) + +class RedHatPostgreSQL(PostgreSQL, RedHatPlugin): + """PostgreSQL related information for Red Hat distributions""" + + def setup(self): + super(RedHatPostgreSQL, self).setup() + # Copy PostgreSQL log files. for file in find("*.log", self.get_option("pghome")): self.add_copy_spec(file) @@ -54,8 +67,22 @@ class postgresql(Plugin, RedHatPlugin): self.add_copy_spec(os.path.join(self.get_option("pghome"), "data" , "PG_VERSION")) self.add_copy_spec(os.path.join(self.get_option("pghome"), "data" , "postmaster.opts")) +class DebianPostgreSQL(PostgreSQL, DebianPlugin, UbuntuPlugin): + """PostgreSQL related information for Debian/Ubuntu distributions""" + + def setup(self): + super(DebianPostgreSQL, self).setup() + + # Copy PostgreSQL log files. + self.add_copy_spec("/var/log/postgresql/*.log") + # Copy PostgreSQL config files. + self.add_copy_spec("/etc/postgresql/*/main/*.conf") + + self.add_copy_spec("/var/lib/postgresql/*/main/PG_VERSION") + self.add_copy_spec("/var/lib/postgresql/*/main/postmaster.opts") + + + + + - def postproc(self): - import shutil - if self.tmp_dir: - shutil.rmtree(self.tmp_dir) diff --git a/sos/plugins/soundcard.py b/sos/plugins/soundcard.py index 0a01499c..0aec3282 100644 --- a/sos/plugins/soundcard.py +++ b/sos/plugins/soundcard.py @@ -12,23 +12,44 @@ ## 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 soundcard(Plugin, RedHatPlugin): + +class Soundcard(Plugin): """ Sound card information """ + plugin_name = "soundcard" + def default_enabled(self): return False def setup(self): - self.add_copy_specs([ - "/proc/asound/*", - "/etc/alsa/*", - "/etc/asound.*"]) + self.add_copy_spec("/proc/asound/*") self.add_cmd_output("lspci | grep -i audio") self.add_cmd_output("aplay -l") self.add_cmd_output("aplay -L") self.add_cmd_output("amixer") - self.add_cmd_output("lsmod | grep snd | awk '{print $1}'", suggest_filename = "sndmodules_loaded") + self.add_cmd_output("lsmod | grep snd | awk '{print $1}'",\ + suggest_filename = "sndmodules_loaded") + +class RedHatSoundcard(Soundcard, RedHatPlugin): + """ Sound card information for RedHat distros + """ + + def setup(self): + super(RedHatSoundcard, self).setup() + + self.add_copy_specs([ + "/etc/alsa/*", + "/etc/asound.*"]) + +class DebianSoundcard(Soundcard, DebianPlugin, UbuntuPlugin): + """ Sound card information for Debian/Ubuntu distros + """ + + def setup(self): + super(DebianSoundcard, self).setup() + + self.add_copy_spec("/etc/pulse/*") |