From f41636b9b84003301af2d281bcf155cbb7b22c2c Mon Sep 17 00:00:00 2001 From: Martin Krizek Date: Tue, 5 Apr 2022 17:25:58 +0200 Subject: [PATCH] Remove deprecated UnsafeProxy (#77455) --- .../fragments/unsafeproxy-deprecated.yml | 2 ++ lib/ansible/utils/unsafe_proxy.py | 19 ------------------- 2 files changed, 2 insertions(+), 19 deletions(-) create mode 100644 changelogs/fragments/unsafeproxy-deprecated.yml diff --git a/changelogs/fragments/unsafeproxy-deprecated.yml b/changelogs/fragments/unsafeproxy-deprecated.yml new file mode 100644 index 00000000000..bd1011c80c3 --- /dev/null +++ b/changelogs/fragments/unsafeproxy-deprecated.yml @@ -0,0 +1,2 @@ +removed_features: + - Remove deprecated ``UnsafeProxy`` diff --git a/lib/ansible/utils/unsafe_proxy.py b/lib/ansible/utils/unsafe_proxy.py index e10fa8a05ec..d78ebf6e8da 100644 --- a/lib/ansible/utils/unsafe_proxy.py +++ b/lib/ansible/utils/unsafe_proxy.py @@ -84,25 +84,6 @@ class NativeJinjaUnsafeText(NativeJinjaText, AnsibleUnsafeText): pass -class UnsafeProxy(object): - def __new__(cls, obj, *args, **kwargs): - from ansible.utils.display import Display - Display().deprecated( - 'UnsafeProxy is being deprecated. Use wrap_var or AnsibleUnsafeBytes/AnsibleUnsafeText directly instead', - version='2.13', collection_name='ansible.builtin' - ) - # In our usage we should only receive unicode strings. - # This conditional and conversion exists to sanity check the values - # we're given but we may want to take it out for testing and sanitize - # our input instead. - if isinstance(obj, AnsibleUnsafe): - return obj - - if isinstance(obj, string_types): - obj = AnsibleUnsafeText(to_text(obj, errors='surrogate_or_strict')) - return obj - - def _wrap_dict(v): return dict((wrap_var(k), wrap_var(item)) for k, item in v.items())