mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-02 04:04:23 -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'])
|
||||
|
||||
if all(not name.strip() for name in p['name']):
|
||||
if len(p['name']) == 1:
|
||||
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")
|
||||
module.fail_json(msg="Package name(s) cannot be empty or whitespace-only")
|
||||
|
||||
if p['state'] in ['present', 'latest']:
|
||||
install_packages(module, p['name'], p['state'], p['world'])
|
||||
|
|
|
@ -169,7 +169,7 @@
|
|||
ansible.builtin.assert:
|
||||
that:
|
||||
- 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
|
||||
community.general.apk:
|
||||
|
@ -181,7 +181,7 @@
|
|||
ansible.builtin.assert:
|
||||
that:
|
||||
- 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
|
||||
community.general.apk:
|
||||
|
@ -204,5 +204,5 @@
|
|||
ansible.builtin.assert:
|
||||
that:
|
||||
- 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
|
Loading…
Add table
Add a link
Reference in a new issue