Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MH mh/mixins/deps.py: deprecation #6465

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/6465-mh-deps-deprecation.yml
Original file line number Diff line number Diff line change
@@ -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).
12 changes: 12 additions & 0 deletions plugins/module_utils/mh/mixins/deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ def text(self):


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
Expand All @@ -46,6 +52,12 @@ def dependency(cls, name, msg):
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,
Expand Down