From c35a7b88d4dc04b86b2462b2be231b6a39649714 Mon Sep 17 00:00:00 2001 From: pypypyo14 <35416123+pypypyo14@users.noreply.github.com> Date: Fri, 27 Dec 2019 14:15:34 +0900 Subject: [PATCH] Homebrew: some functions ignored check_mode option (#65387) update_homebrew and upgrade_all now support check_mode Fixes: #65352 --- changelogs/fragments/65387-homebrew_check_mode_option.yml | 2 ++ lib/ansible/modules/packaging/os/homebrew.py | 8 ++++++++ 2 files changed, 10 insertions(+) create mode 100644 changelogs/fragments/65387-homebrew_check_mode_option.yml diff --git a/changelogs/fragments/65387-homebrew_check_mode_option.yml b/changelogs/fragments/65387-homebrew_check_mode_option.yml new file mode 100644 index 00000000000..98c43927de5 --- /dev/null +++ b/changelogs/fragments/65387-homebrew_check_mode_option.yml @@ -0,0 +1,2 @@ +bugfixes: + - homebrew - fix Homebrew module's some functions ignored check_mode option (https://github.com/ansible/ansible/pull/65387). diff --git a/lib/ansible/modules/packaging/os/homebrew.py b/lib/ansible/modules/packaging/os/homebrew.py index 4d65d8ea957..e371b48e4ea 100644 --- a/lib/ansible/modules/packaging/os/homebrew.py +++ b/lib/ansible/modules/packaging/os/homebrew.py @@ -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',