mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00: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:
@@ -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,
|
self.current_package,
|
||||||
]
|
]
|
||||||
rc, out, err = self.module.run_command(cmd)
|
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)
|
data = json.loads(out)
|
||||||
|
|
||||||
return _check_package_in_json(data, "formulae") or _check_package_in_json(data, "casks")
|
return _check_package_in_json(data, "formulae") or _check_package_in_json(data, "casks")
|
||||||
|
|||||||
Reference in New Issue
Block a user