aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2019-02-08 13:19:56 -0500
committerBryn M. Reeves <bmr@redhat.com>2019-03-21 10:10:53 +0000
commite1ef9928307636ce3e7b98d7dbebfe4c9574f752 (patch)
treec1b9dbf7a15013df1565fa6253b13bab78a0bf50
parent4e7b89f54648ece299a15ffcd07a62ce19457052 (diff)
downloadsos-e1ef9928307636ce3e7b98d7dbebfe4c9574f752.tar.gz
[postgresql] Use postgres 10 scl if installed
Updates the plugin to check if the specified SCL is running, as some systems may have multiple SCL versions installed, but only one will be running at a time. We now use the running version for a pgdump. This is primarily aimed at RHV environments as 4.3 and later use version 10. Resolves: #1562 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/postgresql.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/sos/plugins/postgresql.py b/sos/plugins/postgresql.py
index ebd7863a..78b03fef 100644
--- a/sos/plugins/postgresql.py
+++ b/sos/plugins/postgresql.py
@@ -78,14 +78,25 @@ class PostgreSQL(Plugin):
class RedHatPostgreSQL(PostgreSQL, SCLPlugin):
- packages = ('postgresql', 'rh-postgresql95-postgresql-server', )
+ packages = (
+ 'postgresql',
+ 'rh-postgresql95-postgresql-server',
+ 'rh-postgresql10-postgresql-server'
+ )
def setup(self):
super(RedHatPostgreSQL, self).setup()
- scl = "rh-postgresql95"
pghome = self.get_option("pghome")
+ scl = None
+ for pkg in self.packages[1:]:
+ # The scl name, package name, and service name all differ slightly
+ # but is at least consistent in doing so across versions, so we
+ # need to do some mangling here
+ if self.service_is_running(pkg.replace('-server', '')):
+ scl = pkg.split('-postgresql-')[0]
+
# Copy PostgreSQL log files.
for filename in find("*.log", pghome):
self.add_copy_spec(filename)
@@ -109,7 +120,7 @@ class RedHatPostgreSQL(PostgreSQL, SCLPlugin):
)
)
- if scl in self.scls_matched:
+ if scl and scl in self.scls_matched:
self.do_pg_dump(scl=scl, filename="pgdump-scl-%s.tar" % scl)