mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
elasticsearch_plugin: add check mode support (#3043)
This commit is contained in:
parent
b69fb8a1ca
commit
b09291be2c
1 changed files with 10 additions and 3 deletions
|
@ -142,7 +142,10 @@ def install_plugin(module, plugin_bin, plugin_name, version, url, proxy_host, pr
|
||||||
|
|
||||||
cmd = " ".join(cmd_args)
|
cmd = " ".join(cmd_args)
|
||||||
|
|
||||||
rc, out, err = module.run_command(cmd)
|
if module.check_mode:
|
||||||
|
rc, out, err = 0, "check mode", ""
|
||||||
|
else:
|
||||||
|
rc, out, err = module.run_command(cmd)
|
||||||
|
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
reason = parse_error(out)
|
reason = parse_error(out)
|
||||||
|
@ -155,7 +158,10 @@ def remove_plugin(module, plugin_bin, plugin_name):
|
||||||
|
|
||||||
cmd = " ".join(cmd_args)
|
cmd = " ".join(cmd_args)
|
||||||
|
|
||||||
rc, out, err = module.run_command(cmd)
|
if module.check_mode:
|
||||||
|
rc, out, err = 0, "check mode", ""
|
||||||
|
else:
|
||||||
|
rc, out, err = module.run_command(cmd)
|
||||||
|
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
reason = parse_error(out)
|
reason = parse_error(out)
|
||||||
|
@ -175,7 +181,8 @@ def main():
|
||||||
proxy_host=dict(default=None),
|
proxy_host=dict(default=None),
|
||||||
proxy_port=dict(default=None),
|
proxy_port=dict(default=None),
|
||||||
version=dict(default=None)
|
version=dict(default=None)
|
||||||
)
|
),
|
||||||
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
|
|
||||||
name = module.params["name"]
|
name = module.params["name"]
|
||||||
|
|
Loading…
Reference in a new issue