diff --git a/changelogs/fragments/remove_hash_params.yml b/changelogs/fragments/remove_hash_params.yml new file mode 100644 index 00000000000..bc9e28c6f9c --- /dev/null +++ b/changelogs/fragments/remove_hash_params.yml @@ -0,0 +1,2 @@ +deprecated_features: + - hash_params function in roles/__init__ is being deprecated as it is not in use. diff --git a/lib/ansible/playbook/role/__init__.py b/lib/ansible/playbook/role/__init__.py index c52102128dc..f0384eb0c7b 100644 --- a/lib/ansible/playbook/role/__init__.py +++ b/lib/ansible/playbook/role/__init__.py @@ -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)