Sandro Bonazzola has uploaded a new change for review. Change subject: sos: postgresql: always use db host ......................................................................
sos: postgresql: always use db host Previously it was possible to access the database through unix socket. Now the access for user engine is limited to tcp connection. Changed the call to sosreport for passing db host to postgresql plugin. Change-Id: Ibb4ac5e03e3b6f1f6d7b499c969bdeb5ed9026cb Bug-Url: https://bugzilla.redhat.com/1039747 Signed-off-by: Sandro Bonazzola <[email protected]> --- M src/__main__.py 1 file changed, 10 insertions(+), 38 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-log-collector refs/changes/61/22361/1 diff --git a/src/__main__.py b/src/__main__.py index 9056fbf..80d354d 100755 --- a/src/__main__.py +++ b/src/__main__.py @@ -830,12 +830,14 @@ if self.configuration.get("ticket_number"): opt += '--ticket-number=' + self.configuration.get("ticket_number") - if self.configuration.get("pg_dbhost") == "localhost": - if self.configuration.get("pg_pass"): - opt += ' -k postgresql.dbname=%(pg_dbname)s \ --k postgresql.username=%(pg_user)s \ --k postgresql.password=%(pg_pass)s' - + if self.configuration.get('pg_pass'): + opt = ( + '-k postgresql.dbname=%(pg_dbname)s ' + '-k postgresql.dbhost=%(pg_dbhost)s ' + '-k postgresql.dbport=%(pg_dbport)s ' + '-k postgresql.username=%(pg_user)s ' + '-k postgresql.password=%(pg_pass)s ' + ) stdout = self.caller.call( '/usr/sbin/sosreport --batch --report -o postgresql ' '--tmp-dir=%(local_scratch_dir)s ' + opt @@ -843,9 +845,7 @@ self.parse_sosreport_stdout(stdout) # Prepend postgresql- to the .md5 file that is produced by SOS # so that it is easy to distinguish from the other N reports - # that are all related to hypervisors. Note, that we - # only do this in the case of a local PostgreSQL DB because - # when the DB is remote the .md5 file is not copied. + # that are all related to hypervisors. os.rename( "%s.md5" % (self.configuration["path"]), os.path.join( @@ -853,36 +853,8 @@ "postgresql-%s.md5" % self.configuration["filename"] ) ) - else: - # The PG database is on a remote host - opt = '-k postgresql.dbname=%(pg_dbname)s \ --k postgresql.dbhost=%(pg_dbhost)s \ --k postgresql.dbport=%(pg_dbport)s \ --k postgresql.username=%(pg_user)s \ --k postgresql.password=%(pg_pass)s ' - # REMOVE the following 3 lines when SoS starts shipping psql.py - stdout = self.caller.call( - '/usr/sbin/sosreport --batch --report -o postgresql ' - '--tmp-dir=%(local_scratch_dir)s ' + opt - ) - self.parse_sosreport_stdout(stdout) - os.rename( - "%s.md5" % (self.configuration["path"]), - os.path.join( - self.configuration["local_scratch_dir"], - "postgresql-%s.md5" % self.configuration["filename"] - ) - ) -# Uncomment the code below when base SoS gets the psql.py plug-in -# cmd = '%(ssh_cmd)s \ -#"/usr/sbin/sosreport --batch --report -o postgresql ' + opt -# stdout = self.caller.call(cmd) -# self.parse_sosreport_stdout(stdout) -# self.caller.call('%(scp_cmd)s:%(path)s %(local_scratch_dir)s') -# self.caller.call('%(ssh_cmd)s "rm %(path)s*"') - # Prepend postgresql- to the PostgreSQL SOS report - # so that it is easy to distinguished from the other N reports + # so that it is easy to distinguish from the other N reports # that are all related to hypervisors. os.rename( os.path.join( -- To view, visit http://gerrit.ovirt.org/22361 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibb4ac5e03e3b6f1f6d7b499c969bdeb5ed9026cb Gerrit-PatchSet: 1 Gerrit-Project: ovirt-log-collector Gerrit-Branch: ovirt-log-collector-3.3.2 Gerrit-Owner: Sandro Bonazzola <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
