Yedidyah Bar David has uploaded a new change for review. Change subject: packaging: setup: Force a minimal ETL version ......................................................................
packaging: setup: Force a minimal ETL version Change-Id: Iccef80d1397c6b66ad5a8440e59af238b42416a7 Bug-Url: https://bugzilla.redhat.com/1059283 Signed-off-by: Yedidyah Bar David <[email protected]> --- M packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-dwh/core/__init__.py A packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-dwh/core/check_etl.py 2 files changed, 92 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-dwh refs/changes/24/27524/1 diff --git a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-dwh/core/__init__.py b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-dwh/core/__init__.py index 12a7b85..6906bbe 100644 --- a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-dwh/core/__init__.py +++ b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-dwh/core/__init__.py @@ -19,6 +19,7 @@ from otopi import util +from . import check_etl from . import config from . import misc from . import service @@ -26,6 +27,7 @@ @util.export def createPlugins(context): + check_etl.Plugin(context=context) config.Plugin(context=context) misc.Plugin(context=context) service.Plugin(context=context) diff --git a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-dwh/core/check_etl.py b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-dwh/core/check_etl.py new file mode 100644 index 0000000..85009fb --- /dev/null +++ b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-dwh/core/check_etl.py @@ -0,0 +1,90 @@ +# +# 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. +# + + +import re +import gettext +_ = lambda m: gettext.dgettext(message=m, domain='ovirt-engine-dwh') + + +from otopi import util +from otopi import plugin + + +from ovirt_engine_setup import constants as osetupcons +from ovirt_engine_setup import dwhconstants as odwhcons +from ovirt_engine_setup import dialog +from ovirt_engine_setup import database + + [email protected] +class Plugin(plugin.PluginBase): + + _RE_VERSION = re.compile( + flags=re.VERBOSE, + pattern=r""" + ^ + (?P<version>(\d+\.\d+)) + \. + (?P<minor>(\d+)) + (?P<extra>.*) + $ + """, + ) + + def _parseVersionString(self, string): + matcher = self._RE_VERSION.match(string) + return matcher.group('version'), matcher.group('minor') + + def __init__(self, context): + super(Plugin, self).__init__(context=context) + + @plugin.event( + stage=plugin.Stages.STAGE_VALIDATION, + condition=lambda self: ( + self.environment[odwhcons.CoreEnv.ENABLE] and + not self.environment[osetupcons.DBEnv.NEW_DATABASE] + ), + ) + def _validation(self): + statement = database.Statement( + dbenvkeys=osetupcons.Const.ENGINE_DB_ENV_KEYS, + environment=self.environment, + ) + minimalVersion = statement.getVdcOption( + name='MinimalETLVersion', + ownConnection=True, + ) + currentVersion = odwhcons.Const.RPM_VERSION + minVersion, minMinor = self._parseVersionString(minimalVersion) + curVersion, curMinor = self._parseVersionString(currentVersion) + if ( + (float(curVersion) != float(minVersion)) or + (int(curMinor) < int(minMinor)) + ): + raise RuntimeError( + _( + 'Minimal supported DWH version ({minimal}) is ' + 'incompatible with installed package version ({current})' + ).format( + minimal=minimalVersion, + current=currentVersion, + ) + ) + + +# vim: expandtab tabstop=4 shiftwidth=4 -- To view, visit http://gerrit.ovirt.org/27524 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iccef80d1397c6b66ad5a8440e59af238b42416a7 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-dwh Gerrit-Branch: master Gerrit-Owner: Yedidyah Bar David <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
