Merge remote-tracking branch 'origin/unstable' into unstable

This commit is contained in:
Weblate 2016-01-02 13:11:42 +01:00
commit 6f3dea276e
2 changed files with 11 additions and 4 deletions

View file

@ -31,7 +31,7 @@
"app_manifest_invalid" : "Invalid app manifest",
"app_argument_choice_invalid" : "Invalid choice for argument '{name:s}', it must be one of {choices:s}",
"app_argument_invalid" : "Invalid value for argument '{name:s}': {error:s}",
"app_argument_missing" : "Missing argument '{:s}'",
"app_argument_required" : "Argument '{name:s}' is required",
"app_sources_fetch_failed" : "Unable to fetch sources files",
"ssowat_conf_updated" : "SSOwat persistent configuration successfully updated",
"ssowat_conf_generated" : "SSOwat configuration successfully generated",

View file

@ -1344,15 +1344,22 @@ def _parse_args_from_manifest(manifest, action, args={}, auth=None):
arg_value = input_string
elif 'default' in arg:
arg_value = arg['default']
else:
raise MoulinetteError(errno.EINVAL,
m18n.n('app_argument_missing', name=arg_name))
# Validate argument value
if not arg_value and not arg.get('optional', False):
raise MoulinetteError(errno.EINVAL,
m18n.n('app_argument_required', name=arg_name))
elif not arg_value:
args_list.append('')
continue
# Validate argument choice
if 'choices' in arg and arg_value not in arg['choices']:
raise MoulinetteError(errno.EINVAL,
m18n.n('app_argument_choice_invalid',
name=arg_name, choices=', '.join(arg['choices'])))
# Validate argument type
# TODO: Add more type, e.g. boolean
arg_type = arg.get('type', 'string')
if arg_type == 'domain':