mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[PR #8048/fa30b022 backport][stable-8] fix(homebrew): give correct error message when become true used (#8068)
fix(homebrew): give correct error message when become true used (#8048)
* fix(homebrew): give correct error message when become true used
This commit fixes #8047 by raising the exception coming from calling
homebrew with the `become: true` parameter set.
* chore(changelog): add changelog fragment
(cherry picked from commit fa30b02294
)
Co-authored-by: Michael Wall <thewalla07@gmail.com>
This commit is contained in:
parent
3e235f78d1
commit
c09971a671
2 changed files with 6 additions and 0 deletions
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- homebrew - error returned from brew command was ignored and tried to parse empty JSON. Fix now checks for an error and raises it to give accurate error message to users (https://github.com/ansible-collections/community.general/issues/8047).
|
|
@ -488,6 +488,10 @@ class Homebrew(object):
|
|||
self.current_package,
|
||||
]
|
||||
rc, out, err = self.module.run_command(cmd)
|
||||
if err:
|
||||
self.failed = True
|
||||
self.message = err.strip()
|
||||
raise HomebrewException(self.message)
|
||||
data = json.loads(out)
|
||||
|
||||
return _check_package_in_json(data, "formulae") or _check_package_in_json(data, "casks")
|
||||
|
|
Loading…
Reference in a new issue