elasticsearch_plugin - Show STDERR on module failures. (#41954)

* elasticsearch_plugin - Show STDERR on module failures.

I tried to install a ES plugin without
  become: yes
and found after debugging the module that the module failed ude to permission issues.

The only error message I got was
  Is analysis-icu a valid plugin name?

That was strange considering I followed the example documentation by the letter.

I found out that when this module fails, it hides the real reason for failure.

This patch replaces the generic error with more meaningful diagnostics.

* elasticsearch_plugin - Show STDERR on module failures. Changelog fragment

 samdoran commented 2 days ago

This looks good. Please create a changelog fragment to go along with this change. See fragments for examples.
pull/36595/merge
Olli-Antti Kivilahti 6 years ago committed by Sam Doran
parent fabd7823b2
commit 8eacbd0381

@ -0,0 +1,3 @@
---
bugfixes:
- elasticsearch_plugin - Improve error messages and show stderr of elasticsearch commands

@ -175,7 +175,7 @@ def install_plugin(module, plugin_bin, plugin_name, version, url, proxy_host, pr
if rc != 0:
reason = parse_error(out)
module.fail_json(msg='Is %s a valid plugin name?' % plugin_name, err=reason)
module.fail_json(msg="Installing plugin '%s' failed: %s" % (plugin_name, reason), err=err)
return True, cmd, out, err
@ -192,7 +192,7 @@ def remove_plugin(module, plugin_bin, plugin_name):
if rc != 0:
reason = parse_error(out)
module.fail_json(msg=reason)
module.fail_json(msg="Removing plugin '%s' failed: %s" % (plugin_name, reason), err=err)
return True, cmd, out, err

Loading…
Cancel
Save