mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
* 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>
(cherry picked from commit d24fc92466
)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
6e56bae0f3
commit
de2feb2567
3 changed files with 6 additions and 4 deletions
2
changelogs/fragments/2517-cmd-params-from-vars.yml
Normal file
2
changelogs/fragments/2517-cmd-params-from-vars.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
minor_changes:
|
||||
- cmd (Module Helper) module utils - ``CmdMixin`` now pulls the value for ``run_command()`` params from ``self.vars``, as opposed to previously retrieving those from ``self.module.params`` (https://github.com/ansible-collections/community.general/pull/2517).
|
|
@ -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]
|
||||
|
|
|
@ -258,7 +258,7 @@ class XFConfProperty(CmdMixin, StateMixin, ModuleHelper):
|
|||
|
||||
params = ['channel', 'property', {'create': True}]
|
||||
if self.vars.is_array:
|
||||
params.append({'is_array': True})
|
||||
params.append('is_array')
|
||||
params.append({'values_and_types': (self.vars.value, value_type)})
|
||||
|
||||
if not self.module.check_mode:
|
||||
|
|
Loading…
Reference in a new issue