Homebrew: some functions ignored check_mode option (#65387)

update_homebrew and upgrade_all now support check_mode

Fixes: #65352
This commit is contained in:
pypypyo14 2019-12-27 14:15:34 +09:00 committed by Abhijeet Kasurde
parent 4d1a57453e
commit c35a7b88d4
2 changed files with 10 additions and 0 deletions

View file

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

View file

@ -500,6 +500,10 @@ class Homebrew(object):
# updated -------------------------------- {{{
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([
self.brew_path,
'update',
@ -526,6 +530,10 @@ class Homebrew(object):
# _upgrade_all --------------------------- {{{
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([
self.brew_path,
'upgrade',