Juan Hernandez has uploaded a new change for review.

Change subject: packaging: Generate /etc/httpd/conf.d/ovirt-engine.conf from 
template
......................................................................

packaging: Generate /etc/httpd/conf.d/ovirt-engine.conf from template

Currently we have the content of this file hardcoded into the
engine-setup tool, which complicates adding or modifying content. This
change introduces a templating mechanism so that the content of the file
can easily changed by changing the template.

Change-Id: Ia8841601e7c56492ef2cc78a78ed1223e97457a2
Signed-off-by: Juan Hernandez <[email protected]>
---
M Makefile
M packaging/fedora/setup/basedefs.py
M packaging/fedora/setup/engine-setup.py
A packaging/fedora/setup/httpd.conf.in
M packaging/fedora/spec/ovirt-engine.spec.in
5 files changed, 14 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/98/7398/1

diff --git a/Makefile b/Makefile
index 572e5b2..cceb80b 100644
--- a/Makefile
+++ b/Makefile
@@ -247,6 +247,7 @@
        install -m 644 packaging/fedora/setup/engine-config-install.properties 
$(DESTDIR)$(DATA_DIR)/conf
        install -m 644 packaging/fedora/setup/iptables.default 
$(DESTDIR)$(DATA_DIR)/conf
        install -m 644 packaging/fedora/setup/nfs.sysconfig 
$(DESTDIR)$(DATA_DIR)/conf
+       install -m 644 packaging/fedora/setup/httpd.conf.in 
$(DESTDIR)$(DATA_DIR)/conf
 
        # Shared python modules:
        install -m 644 packaging/fedora/setup/nfsutils.py 
$(DESTDIR)$(DATA_DIR)/scripts
diff --git a/packaging/fedora/setup/basedefs.py 
b/packaging/fedora/setup/basedefs.py
index 34a4aa3..c21d198 100644
--- a/packaging/fedora/setup/basedefs.py
+++ b/packaging/fedora/setup/basedefs.py
@@ -86,6 +86,7 @@
 FILE_ISOUPLOADER_CONF="/etc/ovirt-engine/isouploader.conf"
 FILE_LOGCOLLECTOR_CONF="/etc/ovirt-engine/logcollector.conf"
 FILE_PSQL_CONF="/var/lib/pgsql/data/postgresql.conf"
+FILE_OVIRT_HTTPD_CONF_TEMPLATE="%s/conf/httpd.conf.in" % DIR_ENGINE
 FILE_OVIRT_HTTPD_CONF="/etc/httpd/conf.d/ovirt-engine.conf"
 FILE_HTTPD_SSL_CONFIG="/etc/httpd/conf.d/ssl.conf"
 FILE_HTTPD_CONF="/etc/httpd/conf/httpd.conf"
diff --git a/packaging/fedora/setup/engine-setup.py 
b/packaging/fedora/setup/engine-setup.py
index 0d91259..010db3a 100755
--- a/packaging/fedora/setup/engine-setup.py
+++ b/packaging/fedora/setup/engine-setup.py
@@ -24,6 +24,7 @@
 import tempfile
 from optparse import OptionParser, OptionGroup
 from setup_controller import Controller
+from Cheetah.Template import Template
 
 # Globals
 controller = Controller()
@@ -724,12 +725,11 @@
 
 def _redirectUrl():
     try:
-        # Redirect everything to the application server using the
-        # AJP protocol and configuring the proxy so that it will
-        # retry a failed connection after a short time interval:
-        logging.debug("Redirect oVirt URLs using AJP protocol")
-        redirectStr="ProxyPass / ajp://localhost:%s/ retry=5" 
%(basedefs.JBOSS_AJP_PORT)
+        # Create the Apache configuration fragment from the template:
+        confTemplate = Template(file=basedefs.FILE_OVIRT_HTTPD_CONF_TEMPLATE)
+        confText = str(confTemplate)
 
+        # Save the text produced by the template:
         fd = open(basedefs.FILE_OVIRT_HTTPD_CONF, 'w')
         fd.write(redirectStr)
         fd.close()
diff --git a/packaging/fedora/setup/httpd.conf.in 
b/packaging/fedora/setup/httpd.conf.in
new file mode 100644
index 0000000..013d99e
--- /dev/null
+++ b/packaging/fedora/setup/httpd.conf.in
@@ -0,0 +1,6 @@
+#import basedefs
+
+# Redirect all requests to the application server using the AJP protocol
+# and making sure that the connections will be recovered in a short time
+# interval (5 seconds at the moment):
+ProxyPass / ajp://localhost:${basedefs.JBOSS_AJP_PORT}/ retry=5
diff --git a/packaging/fedora/spec/ovirt-engine.spec.in 
b/packaging/fedora/spec/ovirt-engine.spec.in
index ce98a2a..a7154e6 100644
--- a/packaging/fedora/spec/ovirt-engine.spec.in
+++ b/packaging/fedora/spec/ovirt-engine.spec.in
@@ -273,6 +273,7 @@
 Requires: %{name}
 Requires: lsof
 Requires: nfs-utils
+Requires: python-cheetah
 
 %description setup
 Setup and upgrade scripts for %{product_name_short}


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

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

Reply via email to