Deprecate hash_params (#85630)

we stopped using it long ago, no plugin should be using it either, but JIC deprecate

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/85716/head
Brian Coca 4 months ago committed by GitHub
parent c5ddc93767
commit 8b6446f2d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,2 @@
deprecated_features:
- hash_params function in roles/__init__ is being deprecated as it is not in use.

@ -36,6 +36,7 @@ from ansible.playbook.role.metadata import RoleMetadata
from ansible.playbook.taggable import Taggable
from ansible.plugins.loader import add_all_plugin_dirs
from ansible.utils.collection_loader import AnsibleCollectionConfig
from ansible.utils.display import Display
from ansible.utils.path import is_subpath
from ansible.utils.vars import combine_vars
@ -51,14 +52,12 @@ if _t.TYPE_CHECKING:
__all__ = ['Role', 'hash_params']
# TODO: this should be a utility function, but can't be a member of
# the role due to the fact that it would require the use of self
# in a static method. This is also used in the base class for
# strategies (ansible/plugins/strategy/__init__.py)
_display = Display()
def hash_params(params):
"""
DEPRECATED
Construct a data structure of parameters that is hashable.
This requires changing any mutable data structures into immutable ones.
@ -70,6 +69,12 @@ def hash_params(params):
1) There shouldn't be any unhashable scalars specified in the yaml
2) Our only choice would be to return an error anyway.
"""
_display.deprecated(
msg="The hash_params function is deprecated as its consumers have moved to internal alternatives",
version='2.24',
help_text='Contact the plugin author to update their code',
)
# Any container is unhashable if it contains unhashable items (for
# instance, tuple() is a Hashable subclass but if it contains a dict, it
# cannot be hashed)

Loading…
Cancel
Save