mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
added new tests any and all (#22665)
* added new tests any and all * updated code names
This commit is contained in:
parent
eb0b1e149d
commit
0c44959800
3 changed files with 31 additions and 1 deletions
|
@ -1,7 +1,13 @@
|
|||
Ansible Changes By Release
|
||||
==========================
|
||||
|
||||
## 2.3 TBD - ACTIVE DEVELOPMENT
|
||||
## 2.4 "Dancing Days" - ACTIVE DEVELOPMENT
|
||||
|
||||
#### New: Tests
|
||||
- any : true if any element is true
|
||||
- all: true if all elements are true
|
||||
|
||||
## 2.3 "Ramble On" - RELEASE CANDIDATE
|
||||
|
||||
### Major Changes
|
||||
* Documented and renamed the previously released 'single var vaulting' feature, allowing user to use vault encryption for single variables in a normal YAML vars file.
|
||||
|
|
|
@ -83,6 +83,27 @@ To see if a list includes or is included by another list, you can use 'issubset'
|
|||
|
||||
.. _path_tests:
|
||||
|
||||
.. versionadded:: 2.4
|
||||
|
||||
You can use `any` and `all` to check if any or all elements in a list are true or not::
|
||||
|
||||
vars:
|
||||
mylist:
|
||||
- 1
|
||||
- 3 == 3
|
||||
- True
|
||||
myotherlist:
|
||||
- False
|
||||
- True
|
||||
tasks:
|
||||
|
||||
- debug: msg="all are true!"
|
||||
when: mylist is all
|
||||
|
||||
- debug: msg="at least one is true"
|
||||
when: myotherlist|any
|
||||
|
||||
|
||||
Testing paths
|
||||
`````````````
|
||||
|
||||
|
|
|
@ -137,4 +137,7 @@ class TestModule(object):
|
|||
# version comparison
|
||||
'version_compare': version_compare,
|
||||
|
||||
# lists
|
||||
'any': any,
|
||||
'all': all,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue