Yedidyah Bar David has uploaded a new change for review.

Change subject: packaging: setup: ignore non-working legacy pgpass
......................................................................

packaging: setup: ignore non-working legacy pgpass

Bug-Url: https://bugzilla.redhat.com/1022932
Change-Id: Iddad631ff679f3ba2e338c0925e046ff569b587e
Signed-off-by: Yedidyah Bar David <[email protected]>
---
M packaging/setup/plugins/ovirt-engine-setup/legacy/database.py
1 file changed, 13 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/86/21186/1

diff --git a/packaging/setup/plugins/ovirt-engine-setup/legacy/database.py 
b/packaging/setup/plugins/ovirt-engine-setup/legacy/database.py
index 6cc809d..938e2ee 100644
--- a/packaging/setup/plugins/ovirt-engine-setup/legacy/database.py
+++ b/packaging/setup/plugins/ovirt-engine-setup/legacy/database.py
@@ -64,7 +64,7 @@
                     if ':%s:' % 'postgres' not in l:
                         d = l.split(':')
                         if len(d) == 5:
-                            self.environment.update({
+                            dbenv = {
                                 osetupcons.DBEnv.HOST: d[0],
                                 osetupcons.DBEnv.PORT: int(d[1]),
                                 osetupcons.DBEnv.SECURED: None,
@@ -78,13 +78,23 @@
                                 osetupcons.DBEnv.PASSWORD: d[4],
                                 osetupcons.DBEnv.NEW_DATABASE: False,
                                 osetupcons.CoreEnv.LEGACY_PG_CREDS_FOUND: True,
-                            })
+                            }
                             self.environment[
                                 otopicons.CoreEnv.LOG_FILTER
                             ].append(
                                 self.environment[osetupcons.DBEnv.PASSWORD]
                             )
-                            break
+                            try:
+                                dbovirtutils = database.OvirtUtils(plugin=self)
+                                dbovirtutils.tryDatabaseConnect(dbenv)
+                                self.environment.update(dbenv)
+                                break
+                            except RuntimeError:
+                                self.logger.debug(
+                                    'Cannot connect to database using '
+                                    'existing pgpass file, ignoring it',
+                                    exc_info=True,
+                                )
 
     @plugin.event(
         stage=plugin.Stages.STAGE_SETUP,


-- 
To view, visit http://gerrit.ovirt.org/21186
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iddad631ff679f3ba2e338c0925e046ff569b587e
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yedidyah Bar David <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to