diff options
author | Sloane Hertel <19572925+s-hertel@users.noreply.github.com> | 2021-11-01 17:06:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-01 17:06:49 +0100 |
commit | b5ed41edb34a387c560e172ee2928cc8ac9b4959 (patch) | |
tree | 81b9f7ddff5ecd4391802997a9cd2958a1bb0bdd /test | |
parent | loop/fact delegation fix (#75768) (diff) | |
download | ansible-b5ed41edb34a387c560e172ee2928cc8ac9b4959.tar.xz ansible-b5ed41edb34a387c560e172ee2928cc8ac9b4959.zip |
Skip recursive suboption validation if sub_parameters is not a dict (#75635)
* Skip recursive suboption validation if sub_parameters is not a dictionary
* Ensure sub parameter elements is a sequence to prevent iterating over string characters and causing duplicate error messages for the same param
Diffstat (limited to 'test')
-rw-r--r-- | test/integration/targets/roles_arg_spec/roles/test1/meta/argument_specs.yml | 5 | ||||
-rw-r--r-- | test/integration/targets/roles_arg_spec/test_complex_role_fails.yml | 6 |
2 files changed, 10 insertions, 1 deletions
diff --git a/test/integration/targets/roles_arg_spec/roles/test1/meta/argument_specs.yml b/test/integration/targets/roles_arg_spec/roles/test1/meta/argument_specs.yml index 02edac6606..427946e538 100644 --- a/test/integration/targets/roles_arg_spec/roles/test1/meta/argument_specs.yml +++ b/test/integration/targets/roles_arg_spec/roles/test1/meta/argument_specs.yml @@ -73,6 +73,11 @@ argument_specs: some_second_level: type: "bool" default: true + some_more_dict_options: + type: "dict" + options: + some_second_level: + type: "str" some_str_removed_in: type: "str" removed_in: 2.10 diff --git a/test/integration/targets/roles_arg_spec/test_complex_role_fails.yml b/test/integration/targets/roles_arg_spec/test_complex_role_fails.yml index e44950a134..8764d38275 100644 --- a/test/integration/targets/roles_arg_spec/test_complex_role_fails.yml +++ b/test/integration/targets/roles_arg_spec/test_complex_role_fails.yml @@ -34,7 +34,10 @@ "value of test1_choices must be one of: this paddle game, the astray, this remote control, the chair, got: My dog", "value of some_choices must be one of: choice1, choice2, got: choice4", "argument 'some_second_level' is of type <class 'ansible.parsing.yaml.objects.AnsibleUnicode'> found in 'some_dict_options'. and we were unable to convert to bool: The value 'not-a-bool' is not a valid boolean. ", - "argument 'third_level' is of type <class 'ansible.parsing.yaml.objects.AnsibleUnicode'> found in 'multi_level_option -> second_level'. and we were unable to convert to int: <class 'ansible.parsing.yaml.objects.AnsibleUnicode'> cannot be converted to an int" + "argument 'third_level' is of type <class 'ansible.parsing.yaml.objects.AnsibleUnicode'> found in 'multi_level_option -> second_level'. and we were unable to convert to int: <class 'ansible.parsing.yaml.objects.AnsibleUnicode'> cannot be converted to an int", + "argument 'some_more_dict_options' is of type <class 'ansible.parsing.yaml.objects.AnsibleUnicode'> and we were unable to convert to dict: dictionary requested, could not parse JSON or key=value", + "value of 'some_more_dict_options' must be of type dict or list of dicts", + "dictionary requested, could not parse JSON or key=value", ] tasks: @@ -76,6 +79,7 @@ some_str_removed_in: "foo" some_dict_options: some_second_level: "not-a-bool" + some_more_dict_options: "not-a-dict" multi_level_option: second_level: third_level: "should_be_int" |