mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-04 13:14:24 -07:00
logstash_plugin: command args as list rather than string (#10573)
* logstash_plugin: command args as list rather than string * add changelog frag
This commit is contained in:
parent
85f6a07b19
commit
47ebde3339
2 changed files with 6 additions and 4 deletions
2
changelogs/fragments/10573-logstash-plugin-cmd-list.yml
Normal file
2
changelogs/fragments/10573-logstash-plugin-cmd-list.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
minor_changes:
|
||||
- logstash_plugin - using safer mechanism to run external command (https://github.com/ansible-collections/community.general/issues/10479, https://github.com/ansible-collections/community.general/pull/10520).
|
|
@ -104,17 +104,17 @@ def install_plugin(module, plugin_bin, plugin_name, version, proxy_host, proxy_p
|
|||
cmd_args = [plugin_bin, PACKAGE_STATE_MAP["present"], plugin_name]
|
||||
|
||||
if version:
|
||||
cmd_args.append("--version %s" % version)
|
||||
cmd_args.extend(["--version", version])
|
||||
|
||||
if proxy_host and proxy_port:
|
||||
cmd_args.append("-DproxyHost=%s -DproxyPort=%s" % (proxy_host, proxy_port))
|
||||
cmd_args.extend(["-DproxyHost=%s" % proxy_host, "-DproxyPort=%s" % proxy_port])
|
||||
|
||||
cmd = " ".join(cmd_args)
|
||||
|
||||
if module.check_mode:
|
||||
rc, out, err = 0, "check mode", ""
|
||||
else:
|
||||
rc, out, err = module.run_command(cmd)
|
||||
rc, out, err = module.run_command(cmd_args)
|
||||
|
||||
if rc != 0:
|
||||
reason = parse_error(out)
|
||||
|
@ -131,7 +131,7 @@ def remove_plugin(module, plugin_bin, plugin_name):
|
|||
if module.check_mode:
|
||||
rc, out, err = 0, "check mode", ""
|
||||
else:
|
||||
rc, out, err = module.run_command(cmd)
|
||||
rc, out, err = module.run_command(cmd_args)
|
||||
|
||||
if rc != 0:
|
||||
reason = parse_error(out)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue