mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix the homebrew module failing because of warnings (#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 #8229 #7044 Co-authored-by: Strahinja Kustudic <strahinjak@nordeus.com>
This commit is contained in:
parent
d96b2642bc
commit
43cb5a0d54
3 changed files with 4 additions and 16 deletions
2
changelogs/fragments/8406-fix-homebrew-cask-warning.yaml
Normal file
2
changelogs/fragments/8406-fix-homebrew-cask-warning.yaml
Normal file
|
@ -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).
|
|
@ -415,9 +415,9 @@ class Homebrew(object):
|
||||||
if self.force_formula:
|
if self.force_formula:
|
||||||
cmd.append("--formula")
|
cmd.append("--formula")
|
||||||
rc, out, err = self.module.run_command(cmd)
|
rc, out, err = self.module.run_command(cmd)
|
||||||
if err:
|
if rc != 0:
|
||||||
self.failed = True
|
self.failed = True
|
||||||
self.message = err.strip()
|
self.message = err.strip() or ("Unknown failure with exit code %d" % rc)
|
||||||
raise HomebrewException(self.message)
|
raise HomebrewException(self.message)
|
||||||
data = json.loads(out)
|
data = json.loads(out)
|
||||||
|
|
||||||
|
|
|
@ -12,20 +12,6 @@
|
||||||
path: "{{ brew_which.stdout }}"
|
path: "{{ brew_which.stdout }}"
|
||||||
register: brew_stat
|
register: brew_stat
|
||||||
|
|
||||||
- name: MACOS | Install docker without --formula
|
|
||||||
community.general.homebrew:
|
|
||||||
name: docker
|
|
||||||
state: present
|
|
||||||
become: true
|
|
||||||
become_user: "{{ brew_stat.stat.pw_name }}"
|
|
||||||
ignore_errors: true
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Check that installing docker without --formula raises warning
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result is failed
|
|
||||||
|
|
||||||
- name: MACOS | Install docker
|
- name: MACOS | Install docker
|
||||||
community.general.homebrew:
|
community.general.homebrew:
|
||||||
name: docker
|
name: docker
|
||||||
|
|
Loading…
Reference in a new issue