mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix Homebrew._current_package_is_installed
This commit is contained in:
parent
6748ef121b
commit
81f2e43b76
1 changed files with 8 additions and 7 deletions
|
@ -360,14 +360,15 @@ class Homebrew(object):
|
||||||
self.message = 'Invalid package: {0}.'.format(self.current_package)
|
self.message = 'Invalid package: {0}.'.format(self.current_package)
|
||||||
raise HomebrewException(self.message)
|
raise HomebrewException(self.message)
|
||||||
|
|
||||||
rc, out, err = self.module.run_command(
|
cmd = [
|
||||||
"{brew_path} list -m1 | grep -q '^{package}$'".format(
|
"{brew_path}".format(brew_path=self.brew_path),
|
||||||
brew_path=self.brew_path,
|
"list",
|
||||||
package=self.current_package,
|
"-m1",
|
||||||
)
|
]
|
||||||
)
|
rc, out, err = self.module.run_command(cmd)
|
||||||
|
packages = [package for package in out.split('\n') if package]
|
||||||
|
|
||||||
if rc == 0:
|
if rc == 0 and self.current_package in packages:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Reference in a new issue