Merge "Update ValueError message"
This commit is contained in:
commit
6f6fc5b997
@ -197,9 +197,8 @@ class ContainersController(base.Controller):
|
|||||||
container_dict['interactive'] = strutils.bool_from_string(
|
container_dict['interactive'] = strutils.bool_from_string(
|
||||||
container_dict.get('interactive', False), strict=True)
|
container_dict.get('interactive', False), strict=True)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
msg = _('Valid run or interactive value is ''true'', '
|
raise exception.InvalidValue(_('Valid run or interactive values '
|
||||||
'"false", True, False, "True" and "False"')
|
'are: true, false, True, False'))
|
||||||
raise exception.InvalidValue(msg)
|
|
||||||
|
|
||||||
auto_remove = container_dict.pop('auto_remove', None)
|
auto_remove = container_dict.pop('auto_remove', None)
|
||||||
if auto_remove is not None:
|
if auto_remove is not None:
|
||||||
@ -210,8 +209,8 @@ class ContainersController(base.Controller):
|
|||||||
container_dict['auto_remove'] = strutils.bool_from_string(
|
container_dict['auto_remove'] = strutils.bool_from_string(
|
||||||
auto_remove, strict=True)
|
auto_remove, strict=True)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
msg = _('Auto_remove value are true or false')
|
raise exception.InvalidValue(_('Auto_remove values are: '
|
||||||
raise exception.InvalidValue(msg)
|
'true, false, True, False'))
|
||||||
else:
|
else:
|
||||||
raise exception.InvalidParamInVersion(param='auto_remove',
|
raise exception.InvalidParamInVersion(param='auto_remove',
|
||||||
req_version=req_version,
|
req_version=req_version,
|
||||||
@ -521,14 +520,16 @@ class ContainersController(base.Controller):
|
|||||||
try:
|
try:
|
||||||
force = strutils.bool_from_string(force, strict=True)
|
force = strutils.bool_from_string(force, strict=True)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
msg = _('Valid force values are true, false, 0, 1, yes and no')
|
bools = ', '.join(strutils.TRUE_STRINGS + strutils.FALSE_STRINGS)
|
||||||
raise exception.InvalidValue(msg)
|
raise exception.InvalidValue(_('Valid force values are: %s')
|
||||||
|
% bools)
|
||||||
stop = kwargs.pop('stop', False)
|
stop = kwargs.pop('stop', False)
|
||||||
try:
|
try:
|
||||||
stop = strutils.bool_from_string(stop, strict=True)
|
stop = strutils.bool_from_string(stop, strict=True)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
msg = _('Valid stop values are true, false, 0, 1, yes and no')
|
bools = ', '.join(strutils.TRUE_STRINGS + strutils.FALSE_STRINGS)
|
||||||
raise exception.InvalidValue(msg)
|
raise exception.InvalidValue(_('Valid stop values are: %s')
|
||||||
|
% bools)
|
||||||
compute_api = pecan.request.compute_api
|
compute_api = pecan.request.compute_api
|
||||||
if not force and not stop:
|
if not force and not stop:
|
||||||
utils.validate_container_state(container, 'delete')
|
utils.validate_container_state(container, 'delete')
|
||||||
@ -675,9 +676,10 @@ class ContainersController(base.Controller):
|
|||||||
stderr = strutils.bool_from_string(stderr, strict=True)
|
stderr = strutils.bool_from_string(stderr, strict=True)
|
||||||
timestamps = strutils.bool_from_string(timestamps, strict=True)
|
timestamps = strutils.bool_from_string(timestamps, strict=True)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
msg = _('Valid stdout, stderr and timestamps values are ''true'', '
|
bools = ', '.join(strutils.TRUE_STRINGS + strutils.FALSE_STRINGS)
|
||||||
'"false", True, False, 0 and 1, yes and no')
|
raise exception.InvalidValue(_('Valid stdout, stderr and '
|
||||||
raise exception.InvalidValue(msg)
|
'timestamps values are: %s')
|
||||||
|
% bools)
|
||||||
LOG.debug('Calling compute.container_logs with %s', container.uuid)
|
LOG.debug('Calling compute.container_logs with %s', container.uuid)
|
||||||
context = pecan.request.context
|
context = pecan.request.context
|
||||||
compute_api = pecan.request.compute_api
|
compute_api = pecan.request.compute_api
|
||||||
@ -703,8 +705,9 @@ class ContainersController(base.Controller):
|
|||||||
run = strutils.bool_from_string(run, strict=True)
|
run = strutils.bool_from_string(run, strict=True)
|
||||||
interactive = strutils.bool_from_string(interactive, strict=True)
|
interactive = strutils.bool_from_string(interactive, strict=True)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
msg = _('Valid run values are true, false, 0, 1, yes and no')
|
bools = ', '.join(strutils.TRUE_STRINGS + strutils.FALSE_STRINGS)
|
||||||
raise exception.InvalidValue(msg)
|
raise exception.InvalidValue(_('Valid run or interactive '
|
||||||
|
'values are: %s') % bools)
|
||||||
LOG.debug('Calling compute.container_exec with %(uuid)s command '
|
LOG.debug('Calling compute.container_exec with %(uuid)s command '
|
||||||
'%(command)s',
|
'%(command)s',
|
||||||
{'uuid': container.uuid, 'command': kwargs['command']})
|
{'uuid': container.uuid, 'command': kwargs['command']})
|
||||||
|
@ -145,9 +145,9 @@ class ImagesController(base.Controller):
|
|||||||
try:
|
try:
|
||||||
exact_match = strutils.bool_from_string(exact_match, strict=True)
|
exact_match = strutils.bool_from_string(exact_match, strict=True)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
msg = _("Valid exact_match values are true,"
|
bools = ', '.join(strutils.TRUE_STRINGS + strutils.FALSE_STRINGS)
|
||||||
" false, 0, 1, yes and no")
|
raise exception.InvalidValue(_('Valid exact_match values are: %s')
|
||||||
raise exception.InvalidValue(msg)
|
% bools)
|
||||||
# Valiadtion accepts 'None' so need to convert it to None
|
# Valiadtion accepts 'None' so need to convert it to None
|
||||||
if image_driver:
|
if image_driver:
|
||||||
image_driver = api_utils.string_or_none(image_driver)
|
image_driver = api_utils.string_or_none(image_driver)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user