mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-06 00:09:10 -07:00
ModuleHelper - cmd params now taken from self.vars instead of self.module.params (#2517)
* cmd params now taken from self.vars instead of self.module.params * added changelog fragment * Update changelogs/fragments/2517-cmd-params-from-vars.yml Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
b89eb87ad6
commit
d24fc92466
3 changed files with 6 additions and 4 deletions
|
@ -120,7 +120,7 @@ class CmdMixin(object):
|
|||
cmd_args[0] = self.module.get_bin_path(cmd_args[0], required=True)
|
||||
except ValueError:
|
||||
pass
|
||||
param_list = params if params else self.module.params.keys()
|
||||
param_list = params if params else self.vars.keys()
|
||||
|
||||
for param in param_list:
|
||||
if isinstance(param, dict):
|
||||
|
@ -131,9 +131,9 @@ class CmdMixin(object):
|
|||
fmt = find_format(_param)
|
||||
value = param[_param]
|
||||
elif isinstance(param, str):
|
||||
if param in self.module.argument_spec:
|
||||
if param in self.vars.keys():
|
||||
fmt = find_format(param)
|
||||
value = self.module.params[param]
|
||||
value = self.vars[param]
|
||||
elif param in extra_params:
|
||||
fmt = find_format(param)
|
||||
value = extra_params[param]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue