mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-08 17:29:11 -07:00
Ensure exit_json returns failed = False
This is required for modules that may return a non-zero `rc` value for a successful run, similar to #24865 for Windows fixing **win_chocolatey**. We also disable the dependency on `rc` value only, even if `failed` was set. Adapted unit and integration tests to the new scheme. Updated raw, shell, script, expect to take `rc` into account.
This commit is contained in:
parent
1f78715848
commit
0e160d5c7e
17 changed files with 68 additions and 56 deletions
|
@ -570,10 +570,13 @@ class TaskExecutor:
|
|||
vars_copy.update(result['ansible_facts'])
|
||||
vars_copy.update({'ansible_facts': result['ansible_facts']})
|
||||
|
||||
# set the failed property if the result has a non-zero rc. This will be
|
||||
# overridden below if the failed_when property is set
|
||||
if result.get('rc', 0) != 0:
|
||||
result['failed'] = True
|
||||
# set the failed property if it was missing.
|
||||
if 'failed' not in result:
|
||||
result['failed'] = False
|
||||
|
||||
# set the changed property if it was missing.
|
||||
if 'changed' not in result:
|
||||
result['changed'] = False
|
||||
|
||||
# if we didn't skip this task, use the helpers to evaluate the changed/
|
||||
# failed_when properties
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue