pear: More info if failure occurs (#49735)

* added cli errors to error msg for pear
This commit is contained in:
Brian Coca 2018-12-11 09:38:06 -05:00 committed by GitHub
parent 260512459d
commit 8ce4720f44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- more complete information when pear module has an error message

View file

@ -66,6 +66,7 @@ EXAMPLES = '''
import os
from ansible.module_utils._text import to_text
from ansible.module_utils.basic import AnsibleModule
@ -140,7 +141,7 @@ def remove_packages(module, packages):
rc, stdout, stderr = module.run_command(cmd, check_rc=False)
if rc != 0:
module.fail_json(msg="failed to remove %s" % (package))
module.fail_json(msg="failed to remove %s: %s" % (package, to_text(stdout + stderr)))
remove_c += 1
@ -171,7 +172,7 @@ def install_packages(module, state, packages):
rc, stdout, stderr = module.run_command(cmd, check_rc=False)
if rc != 0:
module.fail_json(msg="failed to install %s" % (package))
module.fail_json(msg="failed to install %s: %s" % (package, to_text(stdout + stderr)))
install_c += 1