1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

[PR #8411/ec886203 backport][stable-9] multiple modules: use new vardict in module (#8419)

multiple modules: use new vardict in module (#8411)

* use new vardict in module

* add changelog frag

* Update changelogs/fragments/8411-locale-gen-vardict.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* set use_old_vardict to false in snap

* set use_old_vardict to false in cpanm

* set use_old_vardict to false in django mod helper

* set use_old_vardict to false in gconftool2_info

* set use_old_vardict to false in kernel_blacklist

* set use_old_vardict to false in mksysb

* set use_old_vardict to false in pipx_info

* set use_old_vardict to false in snap_alias

* update chglog frag

* fix typo

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit ec886203fc)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2024-05-26 14:13:46 +02:00 committed by GitHub
parent 8c9effce1f
commit 9a14980ca7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 24 additions and 4 deletions

View file

@ -0,0 +1,11 @@
bugfixes:
- django module utils - use new ``VarDict`` to prevent deprecation warning (https://github.com/ansible-collections/community.general/issues/8410, https://github.com/ansible-collections/community.general/pull/8411).
- cpanm - use new ``VarDict`` to prevent deprecation warning (https://github.com/ansible-collections/community.general/issues/8410, https://github.com/ansible-collections/community.general/pull/8411).
- gconftool2_info - use new ``VarDict`` to prevent deprecation warning (https://github.com/ansible-collections/community.general/issues/8410, https://github.com/ansible-collections/community.general/pull/8411).
- hponcfg - use new ``VarDict`` to prevent deprecation warning (https://github.com/ansible-collections/community.general/issues/8410, https://github.com/ansible-collections/community.general/pull/8411).
- kernel_blacklist - use new ``VarDict`` to prevent deprecation warning (https://github.com/ansible-collections/community.general/issues/8410, https://github.com/ansible-collections/community.general/pull/8411).
- locale_gen - use new ``VarDict`` to prevent deprecation warning (https://github.com/ansible-collections/community.general/issues/8410, https://github.com/ansible-collections/community.general/pull/8411).
- mksysb - use new ``VarDict`` to prevent deprecation warning (https://github.com/ansible-collections/community.general/issues/8410, https://github.com/ansible-collections/community.general/pull/8411).
- pipx_info - use new ``VarDict`` to prevent deprecation warning (https://github.com/ansible-collections/community.general/issues/8410, https://github.com/ansible-collections/community.general/pull/8411).
- snap - use new ``VarDict`` to prevent deprecation warning (https://github.com/ansible-collections/community.general/issues/8410, https://github.com/ansible-collections/community.general/pull/8411).
- snap_alias - use new ``VarDict`` to prevent deprecation warning (https://github.com/ansible-collections/community.general/issues/8410, https://github.com/ansible-collections/community.general/pull/8411).

View file

@ -54,6 +54,7 @@ class DjangoModuleHelper(ModuleHelper):
django_admin_cmd = None django_admin_cmd = None
arg_formats = {} arg_formats = {}
django_admin_arg_order = () django_admin_arg_order = ()
use_old_vardict = False
def __init__(self): def __init__(self):
argument_spec = dict(django_std_args) argument_spec = dict(django_std_args)

View file

@ -100,7 +100,7 @@ class _Variable(object):
return return
def __str__(self): def __str__(self):
return "<_Variable: value={0!r}, initial={1!r}, diff={2}, output={3}, change={4}, verbosity={5}>".format( return "<Variable: value={0!r}, initial={1!r}, diff={2}, output={3}, change={4}, verbosity={5}>".format(
self.value, self.initial_value, self.diff, self.output, self.change, self.verbosity self.value, self.initial_value, self.diff, self.output, self.change, self.verbosity
) )

View file

@ -170,6 +170,7 @@ class CPANMinus(ModuleHelper):
installdeps=cmd_runner_fmt.as_bool("--installdeps"), installdeps=cmd_runner_fmt.as_bool("--installdeps"),
pkg_spec=cmd_runner_fmt.as_list(), pkg_spec=cmd_runner_fmt.as_list(),
) )
use_old_vardict = False
def __init_module__(self): def __init_module__(self):
v = self.vars v = self.vars

View file

@ -60,6 +60,7 @@ class GConftoolInfo(ModuleHelper):
), ),
supports_check_mode=True, supports_check_mode=True,
) )
use_old_vardict = False
def __init_module__(self): def __init_module__(self):
self.runner = gconftool2_runner(self.module, check_rc=True) self.runner = gconftool2_runner(self.module, check_rc=True)

View file

@ -98,6 +98,7 @@ class HPOnCfg(ModuleHelper):
verbose=cmd_runner_fmt.as_bool("-v"), verbose=cmd_runner_fmt.as_bool("-v"),
minfw=cmd_runner_fmt.as_opt_val("-m"), minfw=cmd_runner_fmt.as_opt_val("-m"),
) )
use_old_vardict = False
def __run__(self): def __run__(self):
runner = CmdRunner( runner = CmdRunner(

View file

@ -67,7 +67,7 @@ class Blacklist(StateModuleHelper):
), ),
supports_check_mode=True, supports_check_mode=True,
) )
mute_vardict_deprecation = True use_old_vardict = False
def __init_module__(self): def __init_module__(self):
self.pattern = re.compile(r'^blacklist\s+{0}$'.format(re.escape(self.vars.name))) self.pattern = re.compile(r'^blacklist\s+{0}$'.format(re.escape(self.vars.name)))

View file

@ -79,6 +79,7 @@ class LocaleGen(StateModuleHelper):
), ),
supports_check_mode=True, supports_check_mode=True,
) )
use_old_vardict = False
def __init_module__(self): def __init_module__(self):
self.vars.set("ubuntu_mode", False) self.vars.set("ubuntu_mode", False)

View file

@ -138,6 +138,7 @@ class MkSysB(ModuleHelper):
backup_dmapi_fs=cmd_runner_fmt.as_bool("-A"), backup_dmapi_fs=cmd_runner_fmt.as_bool("-A"),
combined_path=cmd_runner_fmt.as_func(cmd_runner_fmt.unpack_args(lambda p, n: ["%s/%s" % (p, n)])), combined_path=cmd_runner_fmt.as_func(cmd_runner_fmt.unpack_args(lambda p, n: ["%s/%s" % (p, n)])),
) )
use_old_vardict = False
def __init_module__(self): def __init_module__(self):
if not os.path.isdir(self.vars.storage_path): if not os.path.isdir(self.vars.storage_path):

View file

@ -150,6 +150,7 @@ class PipXInfo(ModuleHelper):
), ),
supports_check_mode=True, supports_check_mode=True,
) )
use_old_vardict = False
def __init_module__(self): def __init_module__(self):
if self.vars.executable: if self.vars.executable:

View file

@ -194,6 +194,7 @@ class Snap(StateModuleHelper):
}, },
supports_check_mode=True, supports_check_mode=True,
) )
use_old_vardict = False
@staticmethod @staticmethod
def _first_non_zero(a): def _first_non_zero(a):
@ -405,8 +406,8 @@ class Snap(StateModuleHelper):
def state_present(self): def state_present(self):
self.vars.meta('classic').set(output=True) self.vars.set_meta('classic', output=True)
self.vars.meta('channel').set(output=True) self.vars.set_meta('channel', output=True)
actionable_refresh = [snap for snap in self.vars.name if self.vars.snap_status_map[snap] == Snap.CHANNEL_MISMATCH] actionable_refresh = [snap for snap in self.vars.name if self.vars.snap_status_map[snap] == Snap.CHANNEL_MISMATCH]
if actionable_refresh: if actionable_refresh:

View file

@ -105,6 +105,7 @@ class SnapAlias(StateModuleHelper):
], ],
supports_check_mode=True, supports_check_mode=True,
) )
use_old_vardict = False
def _aliases(self): def _aliases(self):
n = self.vars.name n = self.vars.name