1
0
Fork 0
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:
John Byrne 2024-08-12 01:34:32 -04:00 committed by GitHub
parent 158947f5e5
commit 76d0222a83
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View file

@ -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).

View file

@ -534,7 +534,12 @@ class HomebrewCask(object):
rc, out, err = self.module.run_command(cmd)
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.'
else: