mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[mod] password argument can't have a default value
This commit is contained in:
parent
40dc8397c1
commit
dc6a12f14b
3 changed files with 9 additions and 1 deletions
|
@ -13,6 +13,7 @@
|
|||
"app_already_up_to_date": "{app:s} is already up-to-date",
|
||||
"app_argument_choice_invalid": "Use one of these choices '{choices:s}' for the argument '{name:s}'",
|
||||
"app_argument_invalid": "Pick a valid value for the argument '{name:s}': {error:s}",
|
||||
"app_argument_password_no_default": "Error while parsing password argument '{name}': password argument can't have a default value for security reason",
|
||||
"app_argument_required": "Argument '{name:s}' is required",
|
||||
"app_change_url_failed_nginx_reload": "Could not reload NGINX. Here is the output of 'nginx -t':\n{nginx_errors:s}",
|
||||
"app_change_url_identical_domains": "The old and new domain/url_path are identical ('{domain:s}{path:s}'), nothing to do.",
|
||||
|
|
|
@ -2468,6 +2468,14 @@ class PasswordArgumentParser(YunoHostArgumentFormatParser):
|
|||
argument_type = "password"
|
||||
default_value = ""
|
||||
|
||||
def parse_question(self, question, user_answers):
|
||||
question = super(PasswordArgumentParser, self).parse_question(question, user_answers)
|
||||
|
||||
if question.default is not None:
|
||||
raise YunohostError('app_argument_password_no_default', name=question.name)
|
||||
|
||||
return question
|
||||
|
||||
|
||||
class PathArgumentParser(YunoHostArgumentFormatParser):
|
||||
argument_type = "path"
|
||||
|
|
|
@ -276,7 +276,6 @@ def test_parse_args_in_yunohost_format_password_optional_with_input_without_ask(
|
|||
assert _parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
@pytest.mark.skip # this should raises
|
||||
def test_parse_args_in_yunohost_format_password_no_input_default():
|
||||
questions = [
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue