Skip to content

Commit

Permalink
elasticsearch_plugin: fix error when setting proxy settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Hovius committed Feb 19, 2025
1 parent a3fd357 commit b66bb3a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- "elasticsearch_plugin - fix ``ERROR: D is not a recognized option`` issue when configuring proxy settings (https://github.com/ansible-collections/community.general/pull/9774, https://github.com/ansible-collections/community.general/issues/9773)."
7 changes: 6 additions & 1 deletion plugins/modules/elasticsearch_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,12 @@ def install_plugin(module, plugin_bin, plugin_name, version, src, url, proxy_hos
cmd_args[2] = plugin_name

if proxy_host and proxy_port:
cmd_args.append("-DproxyHost=%s -DproxyPort=%s" % (proxy_host, proxy_port))
java_opts = ["-Dhttp.proxyHost=%s" % proxy_host,
"-Dhttp.proxyPort=%s" % proxy_port,
"-Dhttps.proxyHost=%s" % proxy_host,
"-Dhttps.proxyPort=%s" % proxy_port]
module.run_command_environ_update = dict(CLI_JAVA_OPTS=" ".join(java_opts), # Elasticsearch 8.x
ES_JAVA_OPTS=" ".join(java_opts)) # Older Elasticsearch versions

# Legacy ES 1.x
if url:
Expand Down

0 comments on commit b66bb3a

Please sign in to comment.