From 2a522420caa20f88f9faf14781849ea9e2cac92a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ram=C3=B3n=20S=C3=A1nchez=20Morales?= Date: Sat, 17 Jun 2023 17:55:57 +0200 Subject: [PATCH] fix(mac_brew_pkg): Use brew path from which MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Antonio Ramón Sánchez Morales --- salt/modules/mac_brew_pkg.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/salt/modules/mac_brew_pkg.py b/salt/modules/mac_brew_pkg.py index 976dd1ad615..006fc3a012a 100644 --- a/salt/modules/mac_brew_pkg.py +++ b/salt/modules/mac_brew_pkg.py @@ -31,7 +31,7 @@ def __virtual__(): """ if __grains__["os"] != "MacOS": return False, "brew module is macos specific" - if not salt.utils.path.which("brew"): + if not _homebrew_bin(): return False, "The 'brew' binary was not found" return __virtualname__ @@ -97,7 +97,7 @@ def _homebrew_bin(): """ Returns the full path to the homebrew binary in the PATH """ - ret = __salt__["cmd.run"]("brew --prefix", output_loglevel="trace") + ret = __salt__["cmd.run"](salt.utils.path.which("brew")+" --prefix", output_loglevel="trace") ret += "/bin/brew" return ret @@ -111,7 +111,7 @@ def _call_brew(*cmd, failhard=True): _cmd = [] if runas: _cmd = ["sudo -i -n -H -u {} -- ".format(runas)] - _cmd = _cmd + [salt.utils.path.which("brew")] + list(cmd) + _cmd = _cmd + [_homebrew_bin()] + list(cmd) _cmd = " ".join(_cmd) runas = None