mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
homebrew_cask: fix upgrade_all changed when nothing upgraded (#8708)
* homebrew_cask: fix upgrade_all changed when nothing upgraded * Add changelog fragment * Update changelogs/fragments/8708-homebrew_cask-fix-upgrade-all.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Add .strip() to upgrade output check Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: John Byrne <john@jobytech.net> Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
158947f5e5
commit
76d0222a83
2 changed files with 8 additions and 1 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- homebrew_cask - fix ``upgrade_all`` returns ``changed`` when nothing upgraded (https://github.com/ansible-collections/community.general/issues/8707, https://github.com/ansible-collections/community.general/pull/8708).
|
|
@ -534,7 +534,12 @@ class HomebrewCask(object):
|
||||||
rc, out, err = self.module.run_command(cmd)
|
rc, out, err = self.module.run_command(cmd)
|
||||||
|
|
||||||
if rc == 0:
|
if rc == 0:
|
||||||
if re.search(r'==> No Casks to upgrade', out.strip(), re.IGNORECASE):
|
# 'brew upgrade --cask' does not output anything if no casks are upgraded
|
||||||
|
if not out.strip():
|
||||||
|
self.message = 'Homebrew casks already upgraded.'
|
||||||
|
|
||||||
|
# handle legacy 'brew cask upgrade'
|
||||||
|
elif re.search(r'==> No Casks to upgrade', out.strip(), re.IGNORECASE):
|
||||||
self.message = 'Homebrew casks already upgraded.'
|
self.message = 'Homebrew casks already upgraded.'
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue