mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 05:40:23 -07:00
Change MH to use the module_utils.vardict.VarDict (#8226)
* change MH to use the module_utils.vardict.VarDict * remove VarsMixin from superclasses of MH * bump vardict deprecation to 11.0.0 + add old/new vardict selection in MH * improve backawards compatibility * improve backawards compatibility * use new vardict in some modules, make adjustments * add changelog frag * adjustment after rebase
This commit is contained in:
parent
be3b66c8b5
commit
62138b288a
10 changed files with 56 additions and 12 deletions
|
@ -123,6 +123,7 @@ class GConftool(StateModuleHelper):
|
|||
],
|
||||
supports_check_mode=True,
|
||||
)
|
||||
use_old_vardict = False
|
||||
|
||||
def __init_module__(self):
|
||||
self.runner = gconftool2_runner(self.module, check_rc=True)
|
||||
|
|
|
@ -67,6 +67,7 @@ class Blacklist(StateModuleHelper):
|
|||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
mute_vardict_deprecation = True
|
||||
|
||||
def __init_module__(self):
|
||||
self.pattern = re.compile(r'^blacklist\s+{0}$'.format(re.escape(self.vars.name)))
|
||||
|
|
|
@ -127,6 +127,7 @@ class Opkg(StateModuleHelper):
|
|||
executable=dict(type="path"),
|
||||
),
|
||||
)
|
||||
use_old_vardict = False
|
||||
|
||||
def __init_module__(self):
|
||||
self.vars.set("install_c", 0, output=False, change=True)
|
||||
|
|
|
@ -201,6 +201,7 @@ class PipX(StateModuleHelper):
|
|||
],
|
||||
supports_check_mode=True,
|
||||
)
|
||||
use_old_vardict = False
|
||||
|
||||
def _retrieve_installed(self):
|
||||
def process_list(rc, out, err):
|
||||
|
|
|
@ -187,6 +187,7 @@ class XFConfProperty(StateModuleHelper):
|
|||
required_together=[('value', 'value_type')],
|
||||
supports_check_mode=True,
|
||||
)
|
||||
use_old_vardict = False
|
||||
|
||||
default_state = 'present'
|
||||
|
||||
|
@ -196,7 +197,7 @@ class XFConfProperty(StateModuleHelper):
|
|||
self.vars.channel)
|
||||
self.vars.set('previous_value', self._get())
|
||||
self.vars.set('type', self.vars.value_type)
|
||||
self.vars.meta('value').set(initial_value=self.vars.previous_value)
|
||||
self.vars.set_meta('value', initial_value=self.vars.previous_value)
|
||||
|
||||
def process_command_output(self, rc, out, err):
|
||||
if err.rstrip() == self.does_not:
|
||||
|
|
|
@ -139,6 +139,7 @@ class XFConfInfo(ModuleHelper):
|
|||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
use_old_vardict = False
|
||||
|
||||
def __init_module__(self):
|
||||
self.runner = xfconf_runner(self.module, check_rc=True)
|
||||
|
@ -176,7 +177,7 @@ class XFConfInfo(ModuleHelper):
|
|||
proc = self._process_list_properties
|
||||
|
||||
with self.runner.context('list_arg channel property', output_process=proc) as ctx:
|
||||
result = ctx.run(**self.vars)
|
||||
result = ctx.run(**self.vars.as_dict())
|
||||
|
||||
if not self.vars.list_arg and self.vars.is_array:
|
||||
output = "value_array"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue