Skip to content

Commit

Permalink
Fix the homebrew module failing because of warnings (ansible-collecti…
Browse files Browse the repository at this point in the history
…ons#8406)

Instead of checking if there is an error message, which can also be a
warning, we now check the return code.

This commit fixes ansible-collections#8229 ansible-collections#7044

Co-authored-by: Strahinja Kustudic <[email protected]>
(cherry picked from commit 43cb5a0)
  • Loading branch information
kustodian authored and felixfontein committed May 27, 2024
1 parent 4c6d439 commit b95e423
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/8406-fix-homebrew-cask-warning.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- homebrew - do not fail when brew prints warnings (https://github.com/ansible-collections/community.general/pull/8406, https://github.com/ansible-collections/community.general/issues/7044).
4 changes: 2 additions & 2 deletions plugins/modules/homebrew.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,9 +488,9 @@ def _current_package_is_installed(self):
self.current_package,
]
rc, out, err = self.module.run_command(cmd)
if err:
if rc != 0:
self.failed = True
self.message = err.strip()
self.message = err.strip() or ("Unknown failure with exit code %d" % rc)
raise HomebrewException(self.message)
data = json.loads(out)

Expand Down

0 comments on commit b95e423

Please sign in to comment.