Skip to content

Commit

Permalink
pkg returns 4 for "nothing to do" (ansible#23007)
Browse files Browse the repository at this point in the history
* 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#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.
  • Loading branch information
mavit authored and Alexander Bethke committed May 15, 2018
1 parent a0be13f commit 0eedb55
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/ansible/modules/packaging/os/pkg5.py
Expand Up @@ -131,7 +131,10 @@ def ensure(module, state, packages, params):
response['results'].append(out)
response['msg'] += err
response['changed'] = True
if rc != 0:
if rc == 4:
response['changed'] = False
response['failed'] = False
elif rc != 0:
module.fail_json(**response)

module.exit_json(**response)
Expand Down

0 comments on commit 0eedb55

Please sign in to comment.