From f09b1e7f4cf19dd968635db724fd47a56d0d306c Mon Sep 17 00:00:00 2001 From: Alexei Znamensky <103110+russoz@users.noreply.github.com> Date: Wed, 3 May 2023 06:48:11 +1200 Subject: [PATCH] MH mh/mixins/deps.py: deprecation (#6465) * MH mh/mixins/deps.py: deprecation * add changelog frag --- changelogs/fragments/6465-mh-deps-deprecation.yml | 2 ++ plugins/module_utils/mh/mixins/deps.py | 12 ++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 changelogs/fragments/6465-mh-deps-deprecation.yml diff --git a/changelogs/fragments/6465-mh-deps-deprecation.yml b/changelogs/fragments/6465-mh-deps-deprecation.yml new file mode 100644 index 0000000000..2115f8207a --- /dev/null +++ b/changelogs/fragments/6465-mh-deps-deprecation.yml @@ -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). diff --git a/plugins/module_utils/mh/mixins/deps.py b/plugins/module_utils/mh/mixins/deps.py index bab8c090bb..2a5b2a716c 100644 --- a/plugins/module_utils/mh/mixins/deps.py +++ b/plugins/module_utils/mh/mixins/deps.py @@ -38,6 +38,12 @@ class DependencyCtxMgr(object): 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 = [] @classmethod @@ -46,6 +52,12 @@ class DependencyMixin(ModuleHelperBase): return cls._dependencies[-1] 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: if not d.has_it: self.module.fail_json(changed=False,