mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
MH mh/mixins/deps.py: deprecation (#6465)
* MH mh/mixins/deps.py: deprecation * add changelog frag
This commit is contained in:
parent
cb81abc636
commit
f09b1e7f4c
2 changed files with 14 additions and 0 deletions
2
changelogs/fragments/6465-mh-deps-deprecation.yml
Normal file
2
changelogs/fragments/6465-mh-deps-deprecation.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
deprecated_features:
|
||||||
|
- ModuleHelper module_utils - ``deps`` mixin for MH classes deprecated in favour of using the ``deps`` module_utils (https://github.com/ansible-collections/community.general/pull/6465).
|
|
@ -38,6 +38,12 @@ class DependencyCtxMgr(object):
|
||||||
|
|
||||||
|
|
||||||
class DependencyMixin(ModuleHelperBase):
|
class DependencyMixin(ModuleHelperBase):
|
||||||
|
"""
|
||||||
|
THIS CLASS IS BEING DEPRECATED.
|
||||||
|
See the deprecation notice in ``DependencyMixin.fail_on_missing_deps()`` below.
|
||||||
|
|
||||||
|
Mixin for mapping module options to running a CLI command with its arguments.
|
||||||
|
"""
|
||||||
_dependencies = []
|
_dependencies = []
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -46,6 +52,12 @@ class DependencyMixin(ModuleHelperBase):
|
||||||
return cls._dependencies[-1]
|
return cls._dependencies[-1]
|
||||||
|
|
||||||
def fail_on_missing_deps(self):
|
def fail_on_missing_deps(self):
|
||||||
|
self.module.deprecate(
|
||||||
|
'The DependencyMixin is being deprecated. '
|
||||||
|
'Modules should use community.general.plugins.module_utils.deps instead.',
|
||||||
|
version='9.0.0',
|
||||||
|
collection_name='community.general',
|
||||||
|
)
|
||||||
for d in self._dependencies:
|
for d in self._dependencies:
|
||||||
if not d.has_it:
|
if not d.has_it:
|
||||||
self.module.fail_json(changed=False,
|
self.module.fail_json(changed=False,
|
||||||
|
|
Loading…
Reference in a new issue