pear: More info if failure occurs (#49735)
* added cli errors to error msg for pear
This commit is contained in:
parent
260512459d
commit
8ce4720f44
2 changed files with 5 additions and 2 deletions
2
changelogs/fragments/pear_better_error.yml
Normal file
2
changelogs/fragments/pear_better_error.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
minor_changes:
|
||||
- more complete information when pear module has an error message
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue