Simone Tiraboschi has uploaded a new change for review. Change subject: Making engine configuration optional during engine-setup ......................................................................
Making engine configuration optional during engine-setup Making engine configuration optional asking to the user if he/she want to configure it during engine-setup. Change-Id: If0302fecf98024adc3a7c796bf762a2009108760 Related-to: https://bugzilla.redhat.com/1080992 Related-to: https://bugzilla.redhat.com/985945 Signed-off-by: Simone Tiraboschi <[email protected]> --- A packaging/setup/ovirt_engine_setup/engineconstants.py M packaging/setup/plugins/ovirt-engine-common/base/core/misc.py M packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/config/options.py 3 files changed, 89 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/12/27512/1 diff --git a/packaging/setup/ovirt_engine_setup/engineconstants.py b/packaging/setup/ovirt_engine_setup/engineconstants.py new file mode 100644 index 0000000..a58c582 --- /dev/null +++ b/packaging/setup/ovirt_engine_setup/engineconstants.py @@ -0,0 +1,47 @@ +# +# 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. +# + + +"""Constants.""" + + +import gettext +_ = lambda m: gettext.dgettext(message=m, domain='ovirt-engine-reports') + + +from otopi import util + + +from constants import osetupattrsclass, osetupattrs + + [email protected] [email protected] +@osetupattrsclass +class CoreEnv(object): + + @osetupattrs( + answerfile=True, + postinstallfile=True, + summary=True, + description=_('Engine configuration'), + ) + def ENABLE(self): + return 'OVESETUP_ENGINE_CORE/enable' + + +# vim: expandtab tabstop=4 shiftwidth=4 diff --git a/packaging/setup/plugins/ovirt-engine-common/base/core/misc.py b/packaging/setup/plugins/ovirt-engine-common/base/core/misc.py index c3b5af9..177f0fc 100644 --- a/packaging/setup/plugins/ovirt-engine-common/base/core/misc.py +++ b/packaging/setup/plugins/ovirt-engine-common/base/core/misc.py @@ -31,6 +31,7 @@ from ovirt_engine_setup import constants as osetupcons +from ovirt_engine_setup import engineconstants as oenginecons from ovirt_engine_setup import dialog @@ -87,6 +88,10 @@ None ) self.environment.setdefault( + oenginecons.CoreEnv.ENABLE, + None + ) + self.environment.setdefault( osetupcons.CoreEnv.UPGRADE_SUPPORTED_VERSIONS, '3.0,3.1,3.2,3.3,3.4' ) diff --git a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/config/options.py b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/config/options.py index 75fa76c..9bdb3e1 100644 --- a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/config/options.py +++ b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/config/options.py @@ -29,6 +29,7 @@ from ovirt_engine_setup import constants as osetupcons +from ovirt_engine_setup import engineconstants as oenginecons from ovirt_engine_setup import dialog @@ -81,6 +82,42 @@ ), ) else: + if self.environment[ + oenginecons.CoreEnv.ENABLE + ] is None: + self.environment[ + oenginecons.CoreEnv.ENABLE + ] = dialog.queryBoolean( + dialog=self.dialog, + name='oenginecons.CoreEnv.ENABLE', + note=_( + 'Configure oVirt Engine on this host? ' + '(@VALUES@) [@DEFAULT@]: ' + ), + prompt=True, + default=True, + ) + if not self.environment[ + oenginecons.CoreEnv.ENABLE + ]: + self.logger.error( + _( + 'Engine configuration rejected with engine ' + 'rpms in place' + ) + ) + raise RuntimeError( + _( + 'Engine Configuration was rejected by user: ' + 'if you don\'t need it, please remove engine rpms' + ) + ) + # TODO: if user don't want to install engine but the + # engine rpm are in place now we abort alerting the user + # to remove them; maybe in the future we can just use + # oenginecons.CoreEnv.ENABLE env variable in all + # other engine plugin files to simply skip additional steps + # with rpm still in place if self.environment[osetupcons.ConfigEnv.ADMIN_PASSWORD] is None: valid = False password = None -- To view, visit http://gerrit.ovirt.org/27512 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If0302fecf98024adc3a7c796bf762a2009108760 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
