From 097ce843366cbf7dfd1a413e27266de15dbd4204 Mon Sep 17 00:00:00 2001 From: Daniel Jaouen Date: Wed, 19 Feb 2014 15:15:37 -0500 Subject: [PATCH] Fix homebrew linked/unlinked output. --- library/packaging/homebrew | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/library/packaging/homebrew b/library/packaging/homebrew index dfb82fa8c8..9609ce4068 100644 --- a/library/packaging/homebrew +++ b/library/packaging/homebrew @@ -626,9 +626,17 @@ class Homebrew(object): if opt] rc, out, err = self.module.run_command(cmd) - self.changed_count += 1 - self.changed = True - self.message = 'Package linked: {0}'.format(self.current_package) + + if rc == 0: + self.changed_count += 1 + self.changed = True + self.message = 'Package linked: {0}'.format(self.current_package) + + return True + else: + self.failed = True + self.message = 'Package could not be linked: {0}.'.format(self.current_package) + raise HomebrewException(self.message) def _link_packages(self): for package in self.packages: @@ -662,9 +670,17 @@ class Homebrew(object): if opt] rc, out, err = self.module.run_command(cmd) - self.changed_count += 1 - self.changed = True - self.message = 'Package unlinked: {0}'.format(self.current_package) + + if rc == 0: + self.changed_count += 1 + self.changed = True + self.message = 'Package unlinked: {0}'.format(self.current_package) + + return True + else: + self.failed = True + self.message = 'Package could not be unlinked: {0}.'.format(self.current_package) + raise HomebrewException(self.message) def _unlink_packages(self): for package in self.packages: