Homebrew: some functions ignored check_mode option (#65387)

update_homebrew and upgrade_all now support check_mode

Fixes: #65352
pull/66084/head
pypypyo14 5 years ago committed by Abhijeet Kasurde
parent 4d1a57453e
commit c35a7b88d4

@ -0,0 +1,2 @@
bugfixes:
- homebrew - fix Homebrew module's some functions ignored check_mode option (https://github.com/ansible/ansible/pull/65387).

@ -500,6 +500,10 @@ class Homebrew(object):
# updated -------------------------------- {{{ # updated -------------------------------- {{{
def _update_homebrew(self): def _update_homebrew(self):
if self.module.check_mode:
self.changed = True
self.message = 'Homebrew would be updated.'
raise HomebrewException(self.message)
rc, out, err = self.module.run_command([ rc, out, err = self.module.run_command([
self.brew_path, self.brew_path,
'update', 'update',
@ -526,6 +530,10 @@ class Homebrew(object):
# _upgrade_all --------------------------- {{{ # _upgrade_all --------------------------- {{{
def _upgrade_all(self): def _upgrade_all(self):
if self.module.check_mode:
self.changed = True
self.message = 'Homebrew packages would be upgraded.'
raise HomebrewException(self.message)
rc, out, err = self.module.run_command([ rc, out, err = self.module.run_command([
self.brew_path, self.brew_path,
'upgrade', 'upgrade',

Loading…
Cancel
Save