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()
reviewable/pr18780/r1
Stoned Elipot 11 years ago
parent 0f3093516d
commit 11524646b4

@ -116,13 +116,13 @@ def install_packages(module, brew_path, packages, options):
if module.check_mode: if module.check_mode:
module.exit_json(changed=True) module.exit_json(changed=True)
cmd = [brew_path, 'install', package]
if options: if options:
rc, out, err = module.run_command([brew_path, 'install', package, options]) cmd.extend(options)
else: rc, out, err = module.run_command(cmd)
rc, out, err = module.run_command([brew_path, 'install', package])
if not query_package(module, brew_path, package): 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 installed_count += 1
@ -133,14 +133,14 @@ def install_packages(module, brew_path, packages, options):
def generate_options_string(install_options): def generate_options_string(install_options):
if install_options is None: if install_options is None:
return '' return None
options_str = '' options = []
for option in install_options: for option in install_options:
options_str += ' --%s' % option options.append('--%s' % option)
return options_str.strip() return options
def main(): def main():

Loading…
Cancel
Save