mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-05 07:54:00 -07:00
New keyword: ignore_unreachable (#43857)
This commit is contained in:
parent
2603604fd6
commit
653d9c0f87
15 changed files with 129 additions and 2 deletions
|
@ -45,6 +45,18 @@ def success(result):
|
|||
return not failed(result)
|
||||
|
||||
|
||||
def unreachable(result):
|
||||
''' Test if task result yields unreachable '''
|
||||
if not isinstance(result, MutableMapping):
|
||||
raise errors.AnsibleFilterError("The 'unreachable' test expects a dictionary")
|
||||
return result.get('unreachable', False)
|
||||
|
||||
|
||||
def reachable(result):
|
||||
''' Test if task result yields reachable '''
|
||||
return not unreachable(result)
|
||||
|
||||
|
||||
def changed(result):
|
||||
''' Test if task result yields changed '''
|
||||
if not isinstance(result, MutableMapping):
|
||||
|
@ -150,6 +162,8 @@ class TestModule(object):
|
|||
'succeeded': success,
|
||||
'success': success,
|
||||
'successful': success,
|
||||
'reachable': reachable,
|
||||
'unreachable': unreachable,
|
||||
|
||||
# changed testing
|
||||
'changed': changed,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue