Simone Tiraboschi has uploaded a new change for review.

Change subject: packaging: setup: handling websocket_proxy rpm from 
websocketproxy plugin
......................................................................

packaging: setup: handling websocket_proxy rpm from websocketproxy plugin

Handling websocketproxy rpm from websocketproxy setup plugin.
The websocketproxy setup plugin is now able to install
the websocketproxy rpm if the user decide to configure it but
the rpm is not present.

Change-Id: I1179ec04c3b24113de30b148fc3e04fc50e29c00
Signed-off-by: Simone Tiraboschi <[email protected]>
---
M packaging/setup/ovirt_engine_setup/websocket_proxy/constants.py
M packaging/setup/plugins/ovirt-engine-setup/websocket_proxy/__init__.py
A packaging/setup/plugins/ovirt-engine-setup/websocket_proxy/packages.py
3 files changed, 106 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/18/32818/1

diff --git a/packaging/setup/ovirt_engine_setup/websocket_proxy/constants.py 
b/packaging/setup/ovirt_engine_setup/websocket_proxy/constants.py
index b655f4f..c6adeb7 100644
--- a/packaging/setup/ovirt_engine_setup/websocket_proxy/constants.py
+++ b/packaging/setup/ovirt_engine_setup/websocket_proxy/constants.py
@@ -38,6 +38,8 @@
 class Const(object):
     WEBSOCKET_PROXY_SERVICE_NAME = 'ovirt-websocket-proxy'
     WEBSOCKET_PROXY_PACKAGE_NAME = 'ovirt-engine-websocket-proxy'
+    WEBSOCKET_PROXY_SETUP_PACKAGE_NAME = \
+        'ovirt-engine-setup-plugin-websocket-proxy'
     WEBSOCKET_PROXY_CERT_NAME = 'websocket-proxy'
 
 
@@ -142,6 +144,14 @@
 
 @util.export
 @util.codegen
+@osetupattrsclass
+class RPMDistroEnv(object):
+    PACKAGES = 'OVESETUP_WSP_RPMDISRO_PACKAGES'
+    PACKAGES_SETUP = 'OVESETUP_WSP_RPMDISRO_PACKAGES_SETUP'
+
+
[email protected]
[email protected]
 class Displays(object):
     CERTIFICATE_REQUEST = 'WSP_CERTIFICATE_REQUEST'
 
diff --git 
a/packaging/setup/plugins/ovirt-engine-setup/websocket_proxy/__init__.py 
b/packaging/setup/plugins/ovirt-engine-setup/websocket_proxy/__init__.py
index 6e59d36..5d03b20 100644
--- a/packaging/setup/plugins/ovirt-engine-setup/websocket_proxy/__init__.py
+++ b/packaging/setup/plugins/ovirt-engine-setup/websocket_proxy/__init__.py
@@ -23,12 +23,14 @@
 
 
 from . import config
+from . import packages
 from . import pki
 
 
 @util.export
 def createPlugins(context):
     config.Plugin(context=context)
+    packages.Plugin(context=context)
     pki.Plugin(context=context)
 
 
diff --git 
a/packaging/setup/plugins/ovirt-engine-setup/websocket_proxy/packages.py 
b/packaging/setup/plugins/ovirt-engine-setup/websocket_proxy/packages.py
new file mode 100644
index 0000000..d0088b1
--- /dev/null
+++ b/packaging/setup/plugins/ovirt-engine-setup/websocket_proxy/packages.py
@@ -0,0 +1,94 @@
+#
+# ovirt-engine-setup -- ovirt engine setup
+# Copyright (C) 2014 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.
+#
+
+
+"""
+Package upgrade 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
+from ovirt_engine_setup.websocket_proxy import constants as owspcons
+
+
[email protected]
+class Plugin(plugin.PluginBase):
+    """
+    Package upgrade plugin.
+    """
+
+    def __init__(self, context):
+        super(Plugin, self).__init__(context=context)
+
+    @plugin.event(
+        stage=plugin.Stages.STAGE_INIT,
+    )
+    def _init(self):
+        self.environment.setdefault(
+            owspcons.RPMDistroEnv.PACKAGES,
+            owspcons.Const.WEBSOCKET_PROXY_PACKAGE_NAME
+        )
+        self.environment.setdefault(
+            owspcons.RPMDistroEnv.PACKAGES_SETUP,
+            owspcons.Const.WEBSOCKET_PROXY_SETUP_PACKAGE_NAME
+        )
+
+    @plugin.event(
+        stage=plugin.Stages.STAGE_CUSTOMIZATION,
+        after=(
+            owspcons.Stages.CONFIG_WEBSOCKET_PROXY_CUSTOMIZATION,
+        ),
+        before=(
+            osetupcons.Stages.DISTRO_RPM_PACKAGE_UPDATE_CHECK,
+        )
+    )
+    def _customization(self):
+        def tolist(s):
+            return [e.strip() for e in s.split(',')]
+
+        self.environment[
+            osetupcons.RPMDistroEnv.PACKAGES_SETUP
+        ].extend(
+            tolist(self.environment[owspcons.RPMDistroEnv.PACKAGES_SETUP])
+        )
+
+        if self.environment[owspcons.ConfigEnv.WEBSOCKET_PROXY_CONFIG]:
+            packages = tolist(
+                self.environment[
+                    owspcons.RPMDistroEnv.PACKAGES
+                ]
+            )
+            self.environment[
+                osetupcons.RPMDistroEnv.PACKAGES_UPGRADE_LIST
+            ].append(
+                {
+                    'packages': packages,
+                },
+            )
+            self.environment[
+                osetupcons.RPMDistroEnv.VERSION_LOCK_APPLY
+            ].extend(packages)
+
+
+# vim: expandtab tabstop=4 shiftwidth=4


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

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

Reply via email to