mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-03 04:34:24 -07:00
Remove redundant conditional
This commit is contained in:
parent
dc6443cc52
commit
12774729c0
2 changed files with 4 additions and 7 deletions
|
@ -372,10 +372,7 @@ def main():
|
||||||
upgrade_packages(module, p['available'])
|
upgrade_packages(module, p['available'])
|
||||||
|
|
||||||
if all(not name.strip() for name in p['name']):
|
if all(not name.strip() for name in p['name']):
|
||||||
if len(p['name']) == 1:
|
module.fail_json(msg="Package name(s) cannot be empty or whitespace-only")
|
||||||
module.fail_json(msg="Package name cannot be empty or whitespace-only")
|
|
||||||
else:
|
|
||||||
module.fail_json(msg="Package names cannot be empty or whitespace-only")
|
|
||||||
|
|
||||||
if p['state'] in ['present', 'latest']:
|
if p['state'] in ['present', 'latest']:
|
||||||
install_packages(module, p['name'], p['state'], p['world'])
|
install_packages(module, p['name'], p['state'], p['world'])
|
||||||
|
|
|
@ -169,7 +169,7 @@
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result_empty is failed
|
- result_empty is failed
|
||||||
- "'Package name cannot be empty' in result_empty.msg"
|
- "'Package name(s) cannot be empty' in result_empty.msg"
|
||||||
|
|
||||||
- name: Install package name with only spaces
|
- name: Install package name with only spaces
|
||||||
community.general.apk:
|
community.general.apk:
|
||||||
|
@ -181,7 +181,7 @@
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result_spaces is failed
|
- result_spaces is failed
|
||||||
- "'Package name cannot be empty' in result_spaces.msg"
|
- "'Package name(s) cannot be empty' in result_spaces.msg"
|
||||||
|
|
||||||
- name: Accept list with valid and empty string
|
- name: Accept list with valid and empty string
|
||||||
community.general.apk:
|
community.general.apk:
|
||||||
|
@ -204,5 +204,5 @@
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result_multiple_empty is failed
|
- result_multiple_empty is failed
|
||||||
- "'All package names are empty or whitespace' in result_multiple_empty.msg"
|
- "'Package name(s) cannot be empty' in result_multiple_empty.msg"
|
||||||
ignore_errors: true
|
ignore_errors: true
|
Loading…
Add table
Add a link
Reference in a new issue