1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

pkg returns 4 for "nothing to do" (#23007)

* pkg returns 4 for "nothing to do"

We need to handle this because our own checking for whether there's anything to do returns false negatives in certain circumstances.

We need to rename the response `rc`, because that name is reserved by
Ansible to indicate a failure if it is non-zero.

Fixes ansible/ansible#22781 and ansible/ansible-modules-extras#932.

* Don't rename `rc` to to `pkg_rc`, and instead override the failure state.

* Drop mention of renamed variable in `pkg5` module.
This commit is contained in:
Peter Oliver 2018-05-15 16:52:54 +01:00 committed by ansibot
parent def434b5c3
commit caddf863df

View file

@ -131,7 +131,10 @@ def ensure(module, state, packages, params):
response['results'].append(out) response['results'].append(out)
response['msg'] += err response['msg'] += err
response['changed'] = True response['changed'] = True
if rc != 0: if rc == 4:
response['changed'] = False
response['failed'] = False
elif rc != 0:
module.fail_json(**response) module.fail_json(**response)
module.exit_json(**response) module.exit_json(**response)