Sandro Bonazzola has uploaded a new change for review.

Change subject: packaging: setup: preserve engine http(s) config
......................................................................

packaging: setup: preserve engine http(s) config

Upgrading from 3.2 preserve existing engine
http and https configuration, still enforcing
http proxy configuration.

Change-Id: I0f62d8462dd0798b0239d5bdb12af527651ac0f5
Bug-Url: https://bugzilla.redhat.com/905754
Signed-off-by: Sandro Bonazzola <[email protected]>
---
M packaging/setup/ovirt_engine_setup/constants.py
M packaging/setup/plugins/ovirt-engine-setup/config/protocols.py
M packaging/setup/plugins/ovirt-engine-setup/legacy/config.py
3 files changed, 63 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/10/17310/1

diff --git a/packaging/setup/ovirt_engine_setup/constants.py 
b/packaging/setup/ovirt_engine_setup/constants.py
index 06559be..ac75445 100644
--- a/packaging/setup/ovirt_engine_setup/constants.py
+++ b/packaging/setup/ovirt_engine_setup/constants.py
@@ -774,6 +774,10 @@
     JBOSS_AJP_PORT = 'OVESETUP_CONFIG/jbossAjpPort'
     JBOSS_DEBUG_ADDRESS = 'OVESETUP_CONFIG/jbossDebugAddress'
     WEBSOCKET_PROXY_PORT = 'OVESETUP_CONFIG/websocketProxyPort'
+    PRESERVE_ENGINE_HTTP = 'OVESETUP_CONFIG/preserveEngineHttp'
+    PRESERVE_ENGINE_HTTPS = 'OVESETUP_CONFIG/preserveEngineHttps'
+    LEGACY_ENGINE_HTTP_PORT = 'OVESETUP_CONFIG/legacyEngineHttpPort'
+    LEGACY_ENGINE_HTTPS_PORT = 'OVESETUP_CONFIG/legacyEngineHttpsPort'
 
     MAC_RANGE_POOL = 'OVESETUP_CONFIG/macRangePool'
 
diff --git a/packaging/setup/plugins/ovirt-engine-setup/config/protocols.py 
b/packaging/setup/plugins/ovirt-engine-setup/config/protocols.py
index 4a9444c..30ea0e7 100644
--- a/packaging/setup/plugins/ovirt-engine-setup/config/protocols.py
+++ b/packaging/setup/plugins/ovirt-engine-setup/config/protocols.py
@@ -67,6 +67,22 @@
             osetupcons.ConfigEnv.JBOSS_DEBUG_ADDRESS,
             osetupcons.Defaults.DEFAULT_NETWORK_JBOSS_DEBUG_ADDRESS
         )
+        self.environment.setdefault(
+            osetupcons.ConfigEnv.PRESERVE_ENGINE_HTTP,
+            False
+        )
+        self.environment.setdefault(
+            osetupcons.ConfigEnv.PRESERVE_ENGINE_HTTPS,
+            False
+        )
+        self.environment.setdefault(
+            osetupcons.ConfigEnv.LEGACY_ENGINE_HTTP_PORT,
+            osetupcons.ConfigEnv.JBOSS_HTTP_PORT
+        )
+        self.environment.setdefault(
+            osetupcons.ConfigEnv.LEGACY_ENGINE_HTTPS_PORT,
+            osetupcons.ConfigEnv.JBOSS_HTTPS_PORT
+        )
 
     @plugin.event(
         stage=plugin.Stages.STAGE_SETUP,
@@ -120,8 +136,6 @@
                 'ENGINE_PROXY_ENABLED=true\n'
                 'ENGINE_PROXY_HTTP_PORT={httpPort}\n'
                 'ENGINE_PROXY_HTTPS_PORT={httpsPort}\n'
-                'ENGINE_HTTP_ENABLED=false\n'
-                'ENGINE_HTTPS_ENABLED=false\n'
                 'ENGINE_AJP_ENABLED=true\n'
                 'ENGINE_AJP_PORT={ajpPort}\n'
             ).format(
@@ -136,6 +150,33 @@
                     osetupcons.ConfigEnv.JBOSS_AJP_PORT
                 ],
             )
+            if not self.environment[
+                osetupcons.ConfigEnv.PRESERVE_ENGINE_HTTP
+            ]:
+                content += 'ENGINE_HTTP_ENABLED=false\n'
+            else:
+                content += (
+                    'ENGINE_HTTP_ENABLED=true\n'
+                    'ENGINE_HTTP_PORT={httpPort}\n'
+                ).format(
+                    httpPort=self.environment[
+                        osetupcons.ConfigEnv.LEGACY_ENGINE_HTTP_PORT
+                    ],
+                )
+
+            if not self.environment[
+                osetupcons.ConfigEnv.PRESERVE_ENGINE_HTTPS
+            ]:
+                content += 'ENGINE_HTTPS_ENABLED=false\n'
+            else:
+                content += (
+                    'ENGINE_HTTPS_ENABLED=true\n'
+                    'ENGINE_HTTPS_PORT={httpsPort}\n'
+                ).format(
+                    httpsPort=self.environment[
+                        osetupcons.ConfigEnv.LEGACY_ENGINE_HTTPS_PORT
+                    ],
+                )
 
         self.environment[otopicons.CoreEnv.MAIN_TRANSACTION].append(
             filetransaction.FileTransaction(
diff --git a/packaging/setup/plugins/ovirt-engine-setup/legacy/config.py 
b/packaging/setup/plugins/ovirt-engine-setup/legacy/config.py
index 1576624..bd66c1a 100644
--- a/packaging/setup/plugins/ovirt-engine-setup/legacy/config.py
+++ b/packaging/setup/plugins/ovirt-engine-setup/legacy/config.py
@@ -74,6 +74,19 @@
                 osetupcons.FileLocations.OVIRT_ENGINE_SERVICE_CONFIG
             ])
 
+        #preserve engine http and https ports.
+        if config.getboolean('ENGINE_HTTP_ENABLED'):
+            self.environment[osetupcons.ConfigEnv.PRESERVE_ENGINE_HTTP] = True
+            self.environment[
+                osetupcons.ConfigEnv.LEGACY_ENGINE_HTTP_PORT
+            ] = config.get('ENGINE_HTTP_PORT')
+
+        if config.getboolean('ENGINE_HTTPS_ENABLED'):
+            self.environment[osetupcons.ConfigEnv.PRESERVE_ENGINE_HTTPS] = True
+            self.environment[
+                osetupcons.ConfigEnv.LEGACY_ENGINE_HTTPS_PORT
+            ] = config.get('ENGINE_HTTPS_PORT')
+
         self.environment[osetupcons.ConfigEnv.FQDN] = config.get('ENGINE_FQDN')
         if not config.getboolean('ENGINE_PROXY_ENABLED'):
             self.environment[osetupcons.ApacheEnv.CONFIGURE_SSL] = True
@@ -119,7 +132,9 @@
         if os.path.exists(legacy_confd):
             for n in glob.glob(os.path.join(legacy_confd, '*.conf')):
                 with open(n, 'r') as f:
-                    
self.environment[otopicons.CoreEnv.MAIN_TRANSACTION].append(
+                    self.environment[
+                        otopicons.CoreEnv.MAIN_TRANSACTION
+                    ].append(
                         filetransaction.FileTransaction(
                             name=os.path.join(
                                 (


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

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