diff options
author | devon-mar <devon-mar@users.noreply.github.com> | 2021-09-10 20:35:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-10 20:35:41 +0200 |
commit | 3e7a6222047aae29db4ce0005c0bdf320c7f7918 (patch) | |
tree | 35354d017cd80f0db4756946e2eb7078fafb33f9 /test/integration/targets | |
parent | Run apache via async (#75682) (diff) | |
download | ansible-3e7a6222047aae29db4ce0005c0bdf320c7f7918.tar.xz ansible-3e7a6222047aae29db4ce0005c0bdf320c7f7918.zip |
Fix unexpected exception when a role has an empty argument_specs.yml (#75604)
* Fix role with empty argument_specs.yml
* Use try/except and add changelog fragment
* Always return a dict
* Add test for empty argument_specs key
Diffstat (limited to 'test/integration/targets')
5 files changed, 25 insertions, 0 deletions
diff --git a/test/integration/targets/roles_arg_spec/roles/empty_argspec/meta/argument_specs.yml b/test/integration/targets/roles_arg_spec/roles/empty_argspec/meta/argument_specs.yml new file mode 100644 index 0000000000..b592aa05b3 --- /dev/null +++ b/test/integration/targets/roles_arg_spec/roles/empty_argspec/meta/argument_specs.yml @@ -0,0 +1,2 @@ +--- +argument_specs: diff --git a/test/integration/targets/roles_arg_spec/roles/empty_argspec/tasks/main.yml b/test/integration/targets/roles_arg_spec/roles/empty_argspec/tasks/main.yml new file mode 100644 index 0000000000..90aab0e0a8 --- /dev/null +++ b/test/integration/targets/roles_arg_spec/roles/empty_argspec/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- debug: + msg: "Role with empty argument_specs key" diff --git a/test/integration/targets/roles_arg_spec/roles/empty_file/meta/argument_specs.yml b/test/integration/targets/roles_arg_spec/roles/empty_file/meta/argument_specs.yml new file mode 100644 index 0000000000..ed97d539c0 --- /dev/null +++ b/test/integration/targets/roles_arg_spec/roles/empty_file/meta/argument_specs.yml @@ -0,0 +1 @@ +--- diff --git a/test/integration/targets/roles_arg_spec/roles/empty_file/tasks/main.yml b/test/integration/targets/roles_arg_spec/roles/empty_file/tasks/main.yml new file mode 100644 index 0000000000..b77b835730 --- /dev/null +++ b/test/integration/targets/roles_arg_spec/roles/empty_file/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- debug: + msg: "Role with empty argument_specs.yml" diff --git a/test/integration/targets/roles_arg_spec/test.yml b/test/integration/targets/roles_arg_spec/test.yml index 06268c6a52..5eca7c73f9 100644 --- a/test/integration/targets/roles_arg_spec/test.yml +++ b/test/integration/targets/roles_arg_spec/test.yml @@ -338,3 +338,19 @@ - debug: var=ansible_failed_result - fail: msg: "Should not get here" + +- name: "New play to reset vars: Test empty argument_specs.yml" + hosts: localhost + gather_facts: false + tasks: + - name: Import role with an empty argument_specs.yml + import_role: + name: empty_file + +- name: "New play to reset vars: Test empty argument_specs key" + hosts: localhost + gather_facts: false + tasks: + - name: Import role with an empty argument_specs key + import_role: + name: empty_argspec |