summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStoned Elipot <stoned.elipot@gmail.com>2013-11-13 23:20:53 +0100
committerStoned Elipot <stoned.elipot@gmail.com>2013-11-13 23:20:53 +0100
commit47072bfb77dbcac535d5c88c583db286f7cd7198 (patch)
tree6ebedcdf99ada23f5c13be836bd5294d63067ae6
parent9e197d3958bdff7f0f6f88e6a17ce0a8194955df (diff)
downloadansible-47072bfb77dbcac535d5c88c583db286f7cd7198.tar.gz
Fix homebrew module's install_options handling
...each given option must be a single element in the arguments list passed as first argument to module.run_command()
-rw-r--r--library/packaging/homebrew16
1 files changed, 8 insertions, 8 deletions
diff --git a/library/packaging/homebrew b/library/packaging/homebrew
index c53d728740..12c2e3e9b5 100644
--- a/library/packaging/homebrew
+++ b/library/packaging/homebrew
@@ -116,13 +116,13 @@ def install_packages(module, brew_path, packages, options):
if module.check_mode:
module.exit_json(changed=True)
+ cmd = [brew_path, 'install', package]
if options:
- rc, out, err = module.run_command([brew_path, 'install', package, options])
- else:
- rc, out, err = module.run_command([brew_path, 'install', package])
+ cmd.extend(options)
+ rc, out, err = module.run_command(cmd)
if not query_package(module, brew_path, package):
- module.fail_json(msg="failed to install %s: %s" % (package, out.strip()))
+ module.fail_json(msg="failed to install %s: '%s' %s" % (package, cmd, out.strip()))
installed_count += 1
@@ -133,14 +133,14 @@ def install_packages(module, brew_path, packages, options):
def generate_options_string(install_options):
if install_options is None:
- return ''
+ return None
- options_str = ''
+ options = []
for option in install_options:
- options_str += ' --%s' % option
+ options.append('--%s' % option)
- return options_str.strip()
+ return options
def main():