aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris J Arges <chris.j.arges@ubuntu.com>2013-04-10 15:33:17 -0500
committerChris J Arges <chris.j.arges@canonical.com>2013-04-10 15:35:09 -0500
commitf8e624fd966d4e3349df907972acc15052ec8e28 (patch)
treed20fdf4d8a738dedb9afb440f5964c31b327dac6
parent1baf743054087363f37d5fcbdf4209a67a8edcd9 (diff)
downloadsos-f8e624fd966d4e3349df907972acc15052ec8e28.tar.gz
Add Ubuntu/Debian support for postgresql plugin.
Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
-rw-r--r--AUTHORS1
-rw-r--r--sos/plugins/postgresql.py39
2 files changed, 34 insertions, 6 deletions
diff --git a/AUTHORS b/AUTHORS
index d90785fb..7aeeac4d 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -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)