Skip to content

Commit

Permalink
multiple modules: use new vardict in module (#8411)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
russoz and felixfontein authored May 26, 2024
1 parent da2c87c commit ec88620
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 4 deletions.
11 changes: 11 additions & 0 deletions changelogs/fragments/8411-locale-gen-vardict.yml
Original file line number Diff line number Diff line change
@@ -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).
1 change: 1 addition & 0 deletions plugins/module_utils/django.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class DjangoModuleHelper(ModuleHelper):
django_admin_cmd = None
arg_formats = {}
django_admin_arg_order = ()
use_old_vardict = False

def __init__(self):
argument_spec = dict(django_std_args)
Expand Down
2 changes: 1 addition & 1 deletion plugins/module_utils/vardict.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def diff_result(self):
return

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
)

Expand Down
1 change: 1 addition & 0 deletions plugins/modules/cpanm.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ class CPANMinus(ModuleHelper):
installdeps=cmd_runner_fmt.as_bool("--installdeps"),
pkg_spec=cmd_runner_fmt.as_list(),
)
use_old_vardict = False

def __init_module__(self):
v = self.vars
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/gconftool2_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class GConftoolInfo(ModuleHelper):
),
supports_check_mode=True,
)
use_old_vardict = False

def __init_module__(self):
self.runner = gconftool2_runner(self.module, check_rc=True)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/hponcfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class HPOnCfg(ModuleHelper):
verbose=cmd_runner_fmt.as_bool("-v"),
minfw=cmd_runner_fmt.as_opt_val("-m"),
)
use_old_vardict = False

def __run__(self):
runner = CmdRunner(
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/kernel_blacklist.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Blacklist(StateModuleHelper):
),
supports_check_mode=True,
)
mute_vardict_deprecation = True
use_old_vardict = False

def __init_module__(self):
self.pattern = re.compile(r'^blacklist\s+{0}$'.format(re.escape(self.vars.name)))
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/locale_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class LocaleGen(StateModuleHelper):
),
supports_check_mode=True,
)
use_old_vardict = False

def __init_module__(self):
self.vars.set("ubuntu_mode", False)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/mksysb.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ class MkSysB(ModuleHelper):
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)])),
)
use_old_vardict = False

def __init_module__(self):
if not os.path.isdir(self.vars.storage_path):
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/pipx_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ class PipXInfo(ModuleHelper):
),
supports_check_mode=True,
)
use_old_vardict = False

def __init_module__(self):
if self.vars.executable:
Expand Down
5 changes: 3 additions & 2 deletions plugins/modules/snap.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ class Snap(StateModuleHelper):
},
supports_check_mode=True,
)
use_old_vardict = False

@staticmethod
def _first_non_zero(a):
Expand Down Expand Up @@ -405,8 +406,8 @@ def _present(self, actionable_snaps, refresh=False):

def state_present(self):

self.vars.meta('classic').set(output=True)
self.vars.meta('channel').set(output=True)
self.vars.set_meta('classic', 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]
if actionable_refresh:
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/snap_alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class SnapAlias(StateModuleHelper):
],
supports_check_mode=True,
)
use_old_vardict = False

def _aliases(self):
n = self.vars.name
Expand Down

0 comments on commit ec88620

Please sign in to comment.