Sandro Bonazzola has uploaded a new change for review.

Change subject: packaging: setup: provide 10-setup-jboss.conf
......................................................................

packaging: setup: provide 10-setup-jboss.conf

provide 10-setup-jboss.conf also with legacy
engine-setup

Change-Id: I0a4cb32e685214a207c259dde5d7884607fc0f7b
Signed-off-by: Sandro Bonazzola <[email protected]>
---
M packaging/fedora/setup/basedefs.py
M packaging/fedora/setup/common_utils.py
M packaging/fedora/setup/engine-setup.py
M packaging/fedora/setup/output_messages.py
4 files changed, 48 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/89/15889/1

diff --git a/packaging/fedora/setup/basedefs.py 
b/packaging/fedora/setup/basedefs.py
index 165bab4..a1d0506 100644
--- a/packaging/fedora/setup/basedefs.py
+++ b/packaging/fedora/setup/basedefs.py
@@ -153,6 +153,9 @@
 # File containing the setup generated java configuration of the engine:
 FILE_ENGINE_CONF_PKI="%s/10-setup-pki.conf" % DIR_ENGINE_CONF
 
+FILE_ENGINE_SERVICE_CONFIG_JBOSS = '%s/10-setup-jboss.conf' % DIR_ENGINE_CONF
+FILE_ENGINE_NOTIFIER_CONFIG_JBOSS = '%s/10-setup-jboss.conf missing' % 
DIR_ENGINE_NOTIFIER_CONF
+
 # This file will be automatically created when the engine goes into
 # maintenance mode during upgrades and automatically removed when the
 # engine goes back into normal mode once the upgrade is finished:
@@ -276,6 +279,10 @@
     "/usr/lib/jvm",
 ]
 
+JBOSS_HOME_DIRS = [
+    "/usr/share/jboss-as"
+]
+
 # Accepted JVMs should give an string matching this when executed with
 # the -version option:
 JAVA_VERSION = "1.7.0"
diff --git a/packaging/fedora/setup/common_utils.py 
b/packaging/fedora/setup/common_utils.py
index 6b3f279..3f9c2ed 100755
--- a/packaging/fedora/setup/common_utils.py
+++ b/packaging/fedora/setup/common_utils.py
@@ -1272,6 +1272,16 @@
         logging.debug("Engine has been configured")
         handler.close()
 
+
+def editEngineSysconfigJBOSS(jbossHome):
+    for f in (basedefs.FILE_ENGINE_SERVICE_CONFIG_JBOSS, 
basedefs.FILE_ENGINE_NOTIFIER_CONFIG_JBOSS):
+        handler = TextConfigFileHandler(f, readExisting=False)
+        handler.open()
+        handler.editParam("JBOSS_HOME", jbossHome)
+        logging.debug("JBOSS has been configured")
+        handler.close()
+
+
 def editEngineSysconfigPKI(
     pkidir,
     caCerticate,
@@ -1586,6 +1596,16 @@
     # Return the result:
     return javaHome
 
+
+def findJBOSSHome():
+    jbossHome = None
+    for jbossDir in basedefs.JBOSS_HOME_DIRS:
+        if os.path.exists(jbossDir):
+            jbossHome = jbossDir
+            break
+    return jbossHome
+
+
 def configureTasksTimeout(timeout,
                           engineConfigBin=basedefs.FILE_ENGINE_CONFIG_BIN,
                           
engineConfigExtended=basedefs.FILE_ENGINE_EXTENDED_CONF):
diff --git a/packaging/fedora/setup/engine-setup.py 
b/packaging/fedora/setup/engine-setup.py
index 3e68960..f795c7c 100755
--- a/packaging/fedora/setup/engine-setup.py
+++ b/packaging/fedora/setup/engine-setup.py
@@ -16,7 +16,6 @@
 import getpass
 import copy
 import time
-import datetime
 import nfsutils
 import basedefs
 import output_messages
@@ -120,6 +119,8 @@
                                                 'functions' : 
[setMaxSharedMemory] },
                                               { 'title'     : 
output_messages.INFO_FIND_JAVA,
                                                 'functions' : [_findJavaHome, 
_editSysconfigJava]},
+                                              { 'title'     : 
output_messages.INFO_FIND_JBOSS,
+                                                'functions' : [_findJBOSSHome, 
_editSysconfigJBOSS]},
                                               { 'title'     : 
output_messages.INFO_CREATE_CA,
                                                 'functions' : [_createCA, 
_editSysconfigPKI]},
                                               { 'title'     : 
output_messages.INFO_UPD_ENGINE_CONF,
@@ -2163,6 +2164,9 @@
 def _editSysconfigJava():
     utils.editEngineSysconfigJava(javaHome=controller.CONF["JAVA_HOME"])
 
+def _editSysconfigJBOSS():
+    utils.editEngineSysconfigJBOSS(jbossHome=controller.CONF["JBOSS_HOME"])
+
 def _editSysconfigPKI():
     utils.editEngineSysconfigPKI(
         pkidir=basedefs.DIR_OVIRT_PKI,
@@ -2201,6 +2205,18 @@
     # Save the result:
     controller.CONF["JAVA_HOME"] = javaHome
 
+
+def _findJBOSSHome():
+    # Find it:
+    jbossHome = utils.findJBOSSHome()
+    if not jbossHome:
+        logging.error("Can't find any supported JBOSS home.")
+        raise Exception(output_messages.ERR_EXP_CANT_FIND_SUPPORTED_JBOSS)
+
+    # Save the result:
+    controller.CONF["JBOSS_HOME"] = jbossHome
+
+
 def isSecondRun():
     if os.path.exists(basedefs.FILE_ENGINE_KEYSTORE):
         logging.debug("%s exists, second run detected", 
basedefs.FILE_ENGINE_KEYSTORE)
diff --git a/packaging/fedora/setup/output_messages.py 
b/packaging/fedora/setup/output_messages.py
index 30c496f..853d6d3 100644
--- a/packaging/fedora/setup/output_messages.py
+++ b/packaging/fedora/setup/output_messages.py
@@ -32,6 +32,7 @@
 INFO_CONFIG_OVIRT_ENGINE="Configuring %s" % basedefs.APP_NAME
 INFO_CONFIG_HTTPD="Configuring HTTPD"
 INFO_FIND_JAVA="Configuring JVM"
+INFO_FIND_JBOSS="Configuring JBOSS"
 INFO_CREATE_CA="Creating CA"
 INFO_CREATE_DB="Creating Database"
 INFO_UPGRADE_DB="Upgrading Database Schema"
@@ -443,6 +444,9 @@
 # Search of JVM:
 ERR_EXP_CANT_FIND_SUPPORTED_JAVA="Error: Can't find any supported JVM"
 
+# Search of JBOSS home:
+ERR_EXP_CANT_FIND_SUPPORTED_JBOSS="Error: Can't find any supported JBOSS home"
+
 # create ovirt-engine.conf
 ERR_CREATE_OVIRT_HTTPD_CONF="Failed creating ovirt-engine.conf file %s"
 


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

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

Reply via email to