Sandro Bonazzola has uploaded a new change for review.

Change subject: packaging: setup: update httpd conf during upgrade
......................................................................

packaging: setup: update httpd conf during upgrade

remove the legacy ovirt-engine.conf file used for
configuring httpd in previous versions while running
engine-setup-2 for upgrading.

Change-Id: I1b82fed02d643497ac86c0f52a887bdea22fabc3
Signed-off-by: Sandro Bonazzola <[email protected]>
---
M packaging/setup/ovirt_engine_setup/constants.py
M packaging/setup/plugins/ovirt-engine-setup/apache/ovirt_engine.py
2 files changed, 35 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/81/15881/1

diff --git a/packaging/setup/ovirt_engine_setup/constants.py 
b/packaging/setup/ovirt_engine_setup/constants.py
index cb301b5..5e5ee05 100644
--- a/packaging/setup/ovirt_engine_setup/constants.py
+++ b/packaging/setup/ovirt_engine_setup/constants.py
@@ -342,6 +342,12 @@
         'ovirt-engine-root-redirect.conf.in',
     )
 
+    HTTPD_CONF_OVIRT_ENGINE_LEGACY = os.path.join(
+        DIR_HTTPD,
+        'conf.d',
+        'ovirt-engine.conf'
+    )
+
     AIO_VDSM_PATH = os.path.join(
         DATADIR,
         'vdsm',
diff --git a/packaging/setup/plugins/ovirt-engine-setup/apache/ovirt_engine.py 
b/packaging/setup/plugins/ovirt-engine-setup/apache/ovirt_engine.py
index 2634283..cfaaa2a 100644
--- a/packaging/setup/plugins/ovirt-engine-setup/apache/ovirt_engine.py
+++ b/packaging/setup/plugins/ovirt-engine-setup/apache/ovirt_engine.py
@@ -19,6 +19,7 @@
 """Apache ovirt-engine plugin."""
 
 
+import os
 import gettext
 _ = lambda m: gettext.dgettext(message=m, domain='ovirt-engine-setup')
 
@@ -78,6 +79,34 @@
                 ],
             )
         )
+        if os.path.exists(
+            osetupcons.FileLocations.HTTPD_CONF_OVIRT_ENGINE_LEGACY
+        ):
+            #creates a backup and allows rollback
+            self.environment[otopicons.CoreEnv.MAIN_TRANSACTION].append(
+                filetransaction.FileTransaction(
+                    name=(
+                        osetupcons.FileLocations.
+                        HTTPD_CONF_OVIRT_ENGINE_LEGACY
+                    ),
+                    content='',
+                )
+            )
+
+    @plugin.event(
+        stage=plugin.Stages.STAGE_CLOSEUP,
+        before=[
+            osetupcons.Stages.APACHE_RESTART,
+        ],
+        condition=lambda self: (
+            os.path.exists(
+                osetupcons.FileLocations.HTTPD_CONF_OVIRT_ENGINE_LEGACY
+            ) and not self.environment[osetupcons.CoreEnv.DEVELOPER_MODE]
+        ),
+    )
+    def _closeup(self):
+        self.environment[osetupcons.ApacheEnv.NEED_RESTART] = True
+        os.remove(osetupcons.FileLocations.HTTPD_CONF_OVIRT_ENGINE_LEGACY)
 
 
 # vim: expandtab tabstop=4 shiftwidth=4


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1b82fed02d643497ac86c0f52a887bdea22fabc3
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