1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

[PR #8708/76d0222a backport][stable-9] homebrew_cask: fix upgrade_all changed when nothing upgraded (#8749)

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>
(cherry picked from commit 76d0222a83)

Co-authored-by: John Byrne <6145795+johnbyrneio@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2024-08-12 08:06:35 +02:00 committed by GitHub
parent 8444902289
commit 5103c3cea0
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) 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: