Alex Lourie has uploaded a new change for review.

Change subject: packaging: configuring ovirt-engine on upgrade
......................................................................

packaging: configuring ovirt-engine on upgrade

* Added a function that configures ovirt-engine
service configuration on upgrade from 3.1

Change-Id: Idf596fa9ecaae5ccc6580c19563b21f706d11cfc
Bug-Url: https://bugzilla.redhat.com/906270
Signed-off-by: Alex Lourie <alou...@redhat.com>
---
M packaging/fedora/setup/basedefs.py
M packaging/fedora/setup/post_upgrade.py
2 files changed, 42 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/25/11825/1

diff --git a/packaging/fedora/setup/basedefs.py 
b/packaging/fedora/setup/basedefs.py
index b985f55..6ac1a6e 100644
--- a/packaging/fedora/setup/basedefs.py
+++ b/packaging/fedora/setup/basedefs.py
@@ -105,6 +105,7 @@
 FILE_HTTPD_CONF="/etc/httpd/conf/httpd.conf"
 FILE_IMAGE_UPLOADER_CONF="/etc/ovirt-engine/imageuploader.conf"
 FILE_ENGINE_VERSION = "%s/version" % DIR_CONFIG
+FILE_WEB_CONF = "/etc/ovirt-engine/web-conf.js"
 
 # File containing the local configuration of the engine:
 FILE_ENGINE_SYSCONFIG="/etc/sysconfig/ovirt-engine"
diff --git a/packaging/fedora/setup/post_upgrade.py 
b/packaging/fedora/setup/post_upgrade.py
index 4fea861..3b3afd0 100755
--- a/packaging/fedora/setup/post_upgrade.py
+++ b/packaging/fedora/setup/post_upgrade.py
@@ -12,6 +12,44 @@
 
 MSG_ERR_UPDATE_PRODUCT_VERSION="Error updating product version"
 
+
+def configureEngine():
+    '''
+    Configure ovirt-engine post upgrade
+    '''
+    # Get DB Pass
+    dbPassword = utils.getDbPassword(basedefs.DB_USER)
+
+    # Set DB Url
+    dbUrl = "jdbc:postgresql://"
+            + utils.getDbHostName()
+            + ":" + utils.getDbPort()
+            + "/" + basedefs.DB_NAME
+
+    # Get current configuration
+    fqdn, httpPort, httpsPort = utils.getHostParams(basedefs.FILE_WEB_CONF)
+
+    # Get encrypted password
+    masked_value_set = [dbPassword]
+    encryptedPassword = utils.encryptEngineDBPass(password=dbPassword,
+                                                  maskList=masked_value_set)
+
+    # Edit sysconfig file
+    utils.editEngineSysconfig(proxyEnabled=False,
+                              dbUrl=dbUrl,
+                              dbUser=utils.getDbUser(),
+                              fqdn=fqdn,
+                              http=httpPort,
+                              https=httpsPort,
+                              javaHome=utils.findJavaHome(),
+                             )
+
+    # Set encrypted password
+    utils.configEncryptedPass(encryptedPassword)
+
+    logging.debug("JBoss configuration was successfully restored")
+
+
 def updateProductVersion():
     """
     Update product version in vdc options
@@ -26,5 +64,8 @@
         logging.error(MSG_ERR_UPDATE_PRODUCT_VERSION)
 
 def run():
+    # Update ovirt-engine service config
+    configureEngine()
+
     # Update product version in db from rpm version
     updateProductVersion()


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idf596fa9ecaae5ccc6580c19563b21f706d11cfc
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
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