Instead of checking if there is an error message, which can also be a
warning, we now check the return code.
This commit fixes#8229#7044
Co-authored-by: Strahinja Kustudic <strahinjak@nordeus.com>
* gomebrew: Move repeated logic from homebrew modules into module_utils
Fixes#8323.
* ghangelog + unit test improvement
* Update changelogs/fragments/8323-refactor-homebrew-logic-module-utils.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
* homebrew: Add force_formula parameter to pass --formula to brew command
Some formulas have names that are also cask formulas (e.g. docker).
When trying to install such a formula, brew prints a warning and returns
a non-zero exit code. This causes Ansible to halt and report the failure.
By allowing the task to set force_formula, we can sidestep this problem.
* Add changelog fragment
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/homebrew.py
Co-authored-by: Felix Fontein <felix@fontein.de>
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
* 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
* fix: detect already installed cask
Use json output v2 to check if formulae and casks are installed
chore: add changelog fragment
* test: add homebrew cask specific tests
* refactor: change cask used in tests
* chore: apply suggestions to changelog fragment