Alex Lourie has uploaded a new change for review.

Change subject: packaging: setup: update postgres service restart functionality
......................................................................

packaging: setup: update postgres service restart functionality

Change-Id: I3aab88dfd754798515419453ddae77939c5915d3
Related-To: https://bugzilla.redhat.com/1029969
Signed-off-by: Alex Lourie <alou...@redhat.com>
---
M packaging/common_utils.py
M packaging/ovirt-engine-dwh-setup.py
2 files changed, 15 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-dwh refs/changes/18/21718/1

diff --git a/packaging/common_utils.py b/packaging/common_utils.py
index 74cd583..28f50b5 100755
--- a/packaging/common_utils.py
+++ b/packaging/common_utils.py
@@ -527,8 +527,7 @@
     '''
     starts the postgresql service
     '''
-    if not isPostgresUp():
-        startPostgresService()
+    startPostgresService()
 
     for i in range(0, POSTGRES_START_CYCLES):
         if isPostgresServerUp():
@@ -547,9 +546,10 @@
         stopPostgresService()
 
 def startPostgresService():
-    logging.debug("starting postgresql")
-    postgres_service = Service('postgresql')
-    postgres_service.start()
+    if not isPostgresUp():
+        logging.debug("starting postgresql")
+        postgres_service = Service('postgresql')
+        postgres_service.start()
 
 def stopPostgresService():
     logging.debug("stopping postgresql")
@@ -833,9 +833,12 @@
                 )
 
 
-def restartPostgres():
+def restartPostgres(skipCheck=False):
     stopPostgres()
-    startPostgres()
+    if skipCheck:
+        startPostgresService()
+    else:
+        startPostgres()
 
 #TODO: Move all execution commands to execCmd
 def execCmd(
@@ -1335,7 +1338,7 @@
     with open(FILE_PG_HBA, 'w') as pghba:
         pghba.write('\n'.join(content))
 
-    restartPostgres()
+    restartPostgres(newval=='md5')
     return True
 
 def setPgHbaIdent():
diff --git a/packaging/ovirt-engine-dwh-setup.py 
b/packaging/ovirt-engine-dwh-setup.py
index 01ace27..5a001a6 100755
--- a/packaging/ovirt-engine-dwh-setup.py
+++ b/packaging/ovirt-engine-dwh-setup.py
@@ -569,6 +569,10 @@
             if db_dict['password']:
                 setDbPass(db_dict)
 
+            if pg_updated:
+                utils.restorePgHba()
+                time.sleep(2)
+
             # Start Services
             utils.startEngine()
             # Sleep for 20 secs to allow health applet to start
@@ -604,9 +608,6 @@
     finally:
         if os.path.exists(PGPASS_TEMP):
             os.remove(PGPASS_TEMP)
-
-        if pg_updated:
-            utils.restorePgHba()
 
         return rc
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3aab88dfd754798515419453ddae77939c5915d3
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-dwh
Gerrit-Branch: ovirt-3.3.1
Gerrit-Owner: Alex Lourie <alou...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to