mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-28 03:00:23 -07:00
Merge pull request #6749 from danieljaouen/brew
Update homebrew module.
This commit is contained in:
commit
ddd68be4e0
1 changed files with 10 additions and 8 deletions
|
@ -362,16 +362,18 @@ class Homebrew(object):
|
||||||
|
|
||||||
cmd = [
|
cmd = [
|
||||||
"{brew_path}".format(brew_path=self.brew_path),
|
"{brew_path}".format(brew_path=self.brew_path),
|
||||||
"list",
|
"info",
|
||||||
"-m1",
|
self.current_package,
|
||||||
]
|
]
|
||||||
rc, out, err = self.module.run_command(cmd)
|
rc, out, err = self.module.run_command(cmd)
|
||||||
packages = [package for package in out.split('\n') if package]
|
for line in out.split('\n'):
|
||||||
|
if (
|
||||||
|
re.search(r'Built from source', line)
|
||||||
|
or re.search(r'Poured from bottle', line)
|
||||||
|
):
|
||||||
|
return True
|
||||||
|
|
||||||
if rc == 0 and self.current_package in packages:
|
return False
|
||||||
return True
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
|
|
||||||
def _outdated_packages(self):
|
def _outdated_packages(self):
|
||||||
rc, out, err = self.module.run_command([
|
rc, out, err = self.module.run_command([
|
||||||
|
@ -537,7 +539,7 @@ class Homebrew(object):
|
||||||
cmd = [opt for opt in opts if opt]
|
cmd = [opt for opt in opts if opt]
|
||||||
rc, out, err = self.module.run_command(cmd)
|
rc, out, err = self.module.run_command(cmd)
|
||||||
|
|
||||||
if not self._current_package_is_outdated():
|
if self._current_package_is_installed() and not self._current_package_is_outdated():
|
||||||
self.changed_count += 1
|
self.changed_count += 1
|
||||||
self.changed = True
|
self.changed = True
|
||||||
self.message = 'Package upgraded: {0}'.format(self.current_package)
|
self.message = 'Package upgraded: {0}'.format(self.current_package)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue