Simone Tiraboschi has uploaded a new change for review. Change subject: packaging: setup: raising on invalid application mode values ......................................................................
packaging: setup: raising on invalid application mode values It was threating every invalid application mode values as virtOnly. Checking it for a more consistent behaviour. Change-Id: Ic47e171ddc76a9881e4a915f62dbae762a72f9f8 Bug-Url: https://bugzilla.redhat.com/1149575 Signed-off-by: Simone Tiraboschi <stira...@redhat.com> --- M packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/config/appmode.py 1 file changed, 25 insertions(+), 16 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/94/39094/1 diff --git a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/config/appmode.py b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/config/appmode.py index 01c4e8e..280f888 100644 --- a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/config/appmode.py +++ b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/config/appmode.py @@ -40,6 +40,7 @@ class ApplicationMode(object): VirtOnly = 1 GlusterOnly = 2 + AllModes = 255 def __init__(self, context): super(Plugin, self).__init__(context=context) @@ -138,23 +139,31 @@ ), ) - if v != 'both': - self.environment[oenginecons.EngineDBEnv.STATEMENT].execute( - statement=""" - select fn_db_update_config_value( - 'ApplicationMode', - %(mode)s, - 'general' - ) - """, - args=dict( - mode=str( - self.ApplicationMode.GlusterOnly - if v == 'gluster' - else self.ApplicationMode.VirtOnly - ), - ), + if v == 'virt': + mode = self.ApplicationMode.VirtOnly + elif v == 'gluster': + mode = self.ApplicationMode.GlusterOnly + elif v == 'both': + mode = self.ApplicationMode.AllModes + else: + raise RuntimeError( + _('Selected application mode \'{v}\' is not allowed').format( + v=v, + ) ) + self.environment[oenginecons.EngineDBEnv.STATEMENT].execute( + statement=""" + select fn_db_update_config_value( + 'ApplicationMode', + %(mode)s, + 'general' + ) + """, + args=dict( + mode=mode, + ), + ) + # vim: expandtab tabstop=4 shiftwidth=4 -- To view, visit https://gerrit.ovirt.org/39094 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic47e171ddc76a9881e4a915f62dbae762a72f9f8 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Simone Tiraboschi <stira...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches