diff options
author | Sandro Bonazzola <sbonazzo@redhat.com> | 2014-02-04 15:15:51 +0000 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2014-02-04 15:15:51 +0000 |
commit | 7c53bbe37e1841777a95331ccaf6a43f39e23f86 (patch) | |
tree | 38e494c8232ac3839eec11169680524a984afde7 | |
parent | ec82bf842d2c8537bf020909cfd406ec0ec3f023 (diff) | |
download | sos-7c53bbe37e1841777a95331ccaf6a43f39e23f86.tar.gz |
postgresql: add logs about errors / warnings
give more info to support about what happened while
collecting the report.
Signed-off-by: Sandro Bonazzola <sbonazzo@redhat.com>
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/plugins/postgresql.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/sos/plugins/postgresql.py b/sos/plugins/postgresql.py index 478faff2..0aa67a15 100644 --- a/sos/plugins/postgresql.py +++ b/sos/plugins/postgresql.py @@ -33,10 +33,13 @@ class PostgreSQL(Plugin): ) ) if old_env_pgpassword is not None: - os.environ["PGPASSWORD"] = old_env_pgpassword + os.environ["PGPASSWORD"] = str(old_env_pgpassword) if (status == 0): self.add_copy_spec(dest_file) else: + self.soslog.error( + "Unable to execute pg_dump. Error(%s)" % (output) + ) self.add_alert( "ERROR: Unable to execute pg_dump. Error(%s)" % (output) ) @@ -47,14 +50,30 @@ class PostgreSQL(Plugin): self.tmp_dir = tempfile.mkdtemp() self.pg_dump() else: + self.soslog.warning( + "password must be supplied to dump a database." + ) self.add_alert( "WARN: password must be supplied to dump a database." ) + else: + self.soslog.warning( + "dbname must be supplied to dump a database." + ) + self.add_alert( + "WARN: dbname must be supplied to dump a database." + ) def postproc(self): import shutil if self.tmp_dir: - shutil.rmtree(self.tmp_dir) + try: + shutil.rmtree(self.tmp_dir) + except shutil.Error: + self.soslog.exception( + "Unable to remove %s." % (self.tmp_dir) + ) + self.add_alert("ERROR: Unable to remove %s." % (self.tmp_dir)) class RedHatPostgreSQL(PostgreSQL, RedHatPlugin): |