Alon Bar-Lev has uploaded a new change for review.

Change subject: packaging: setup: generate apache configuration only one time
......................................................................

packaging: setup: generate apache configuration only one time

currently if user selects to generate root and ssl configuration, this
will be done at upgrade as well.

there is no actual reason to perform this at upgrade as if configuration
is working we should leave it as-is.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1058327
Change-Id: Iadae29234702c35fbead6bdb45eccffed895a109
Signed-off-by: Alon Bar-Lev <[email protected]>
---
M packaging/setup/ovirt_engine_setup/constants.py
M packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/apache/__init__.py
A packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/apache/misc.py
M packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/apache/root.py
M packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/apache/ssl.py
5 files changed, 93 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/62/23762/1

diff --git a/packaging/setup/ovirt_engine_setup/constants.py 
b/packaging/setup/ovirt_engine_setup/constants.py
index 88cc3f3..1136cf9 100644
--- a/packaging/setup/ovirt_engine_setup/constants.py
+++ b/packaging/setup/ovirt_engine_setup/constants.py
@@ -1010,10 +1010,15 @@
     NEED_RESTART = 'OVESETUP_APACHE/needRestart'
 
     @osetupattrs(
+        postinstallfile=True,
+    )
+    def CONFIGURED(self):
+        return 'OVESETUP_APACHE/configured'
+
+    @osetupattrs(
         answerfile=True,
         summary=True,
         description=_('Configure Apache SSL'),
-        postinstallfile=True,
     )
     def CONFIGURE_SSL(self):
         return 'OVESETUP_APACHE/configureSsl'
@@ -1022,7 +1027,6 @@
         answerfile=True,
         summary=True,
         description=_('Set application as default page'),
-        postinstallfile=True,
     )
     def CONFIGURE_ROOT_REDIRECTION(self):
         return 'OVESETUP_APACHE/configureRootRedirection'
diff --git 
a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/apache/__init__.py 
b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/apache/__init__.py
index 147624b..c006794 100644
--- a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/apache/__init__.py
+++ b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/apache/__init__.py
@@ -22,6 +22,7 @@
 from otopi import util
 
 
+from . import misc
 from . import root
 from . import ssl
 from . import selinux
@@ -30,6 +31,7 @@
 
 @util.export
 def createPlugins(context):
+    misc.Plugin(context=context)
     root.Plugin(context=context)
     ssl.Plugin(context=context)
     engine.Plugin(context=context)
diff --git 
a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/apache/misc.py 
b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/apache/misc.py
new file mode 100644
index 0000000..eed7a65
--- /dev/null
+++ b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/apache/misc.py
@@ -0,0 +1,57 @@
+#
+# ovirt-engine-setup -- ovirt engine setup
+# Copyright (C) 2013 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+"""Apache misc plugin."""
+
+
+import gettext
+_ = lambda m: gettext.dgettext(message=m, domain='ovirt-engine-setup')
+
+
+from otopi import util
+from otopi import plugin
+
+
+from ovirt_engine_setup import constants as osetupcons
+
+
[email protected]
+class Plugin(plugin.PluginBase):
+    """Apache misc plugin."""
+
+    def __init__(self, context):
+        super(Plugin, self).__init__(context=context)
+
+    @plugin.event(
+        stage=plugin.Stages.STAGE_INIT,
+    )
+    def _init(self):
+        self.environment.setdefault(
+            osetupcons.ApacheEnv.CONFIGURED,
+            False
+        )
+
+    @plugin.event(
+        stage=plugin.Stages.STAGE_MISC,
+        priority=plugin.Stages.PRIORITY_LOW,
+    )
+    def _misc(self):
+        self.environment[osetupcons.ApacheEnv.CONFIGURED] = True
+
+
+# vim: expandtab tabstop=4 shiftwidth=4
diff --git 
a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/apache/root.py 
b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/apache/root.py
index 9c671eb..578e576 100644
--- a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/apache/root.py
+++ b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/apache/root.py
@@ -63,9 +63,20 @@
         condition=lambda self: self._enabled,
     )
     def _setup(self):
-        self._enabled = not self.environment[
-            osetupcons.CoreEnv.DEVELOPER_MODE
-        ]
+        if (
+            self.environment[
+                osetupcons.ApacheEnv.CONFIGURE_ROOT_REDIRECTION
+            ] is None and
+            (
+                self.environment[
+                    osetupcons.CoreEnv.DEVELOPER_MODE
+                ] or
+                self.environment[
+                    osetupcons.ApacheEnv.CONFIGURED
+                ]
+            )
+        ):
+            self._enabled = False
 
     @plugin.event(
         stage=plugin.Stages.STAGE_CUSTOMIZATION,
diff --git 
a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/apache/ssl.py 
b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/apache/ssl.py
index 0aae09d..278abb1 100644
--- a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/apache/ssl.py
+++ b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/apache/ssl.py
@@ -72,9 +72,20 @@
         condition=lambda self: self._enabled,
     )
     def _setup(self):
-        self._enabled = not self.environment[
-            osetupcons.CoreEnv.DEVELOPER_MODE
-        ]
+        if (
+            self.environment[
+                osetupcons.ApacheEnv.CONFIGURE_SSL
+            ] is None and
+            (
+                self.environment[
+                    osetupcons.CoreEnv.DEVELOPER_MODE
+                ] or
+                self.environment[
+                    osetupcons.ApacheEnv.CONFIGURED
+                ]
+            )
+        ):
+            self._enabled = False
 
     @plugin.event(
         stage=plugin.Stages.STAGE_CUSTOMIZATION,


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iadae29234702c35fbead6bdb45eccffed895a109
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.4
Gerrit-Owner: Alon Bar-Lev <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to