Revert "[stable-2.7] Handle sets differently than lists in wrap_var. Fixes #47372."

This reverts commit 0e933f76ba.

The tests for this were broken on centos6 because jinja2 does not have
a map filter on that platform.  Tests need to be rewritten
pull/47362/head
Toshio Kuratomi 6 years ago
parent 210a43ebeb
commit ccabc2bff5

@ -1,2 +0,0 @@
bugfixes:
- unsafe - Add special casing to sets, to support wrapping elements of sets correctly in Python 3 (https://github.com/ansible/ansible/issues/47372)

@ -95,17 +95,11 @@ def _wrap_list(v):
return v return v
def _wrap_set(v):
return set(item if item is None else wrap_var(item) for item in v)
def wrap_var(v): def wrap_var(v):
if isinstance(v, Mapping): if isinstance(v, Mapping):
v = _wrap_dict(v) v = _wrap_dict(v)
elif isinstance(v, MutableSequence): elif isinstance(v, (MutableSequence, Set)):
v = _wrap_list(v) v = _wrap_list(v)
elif isinstance(v, Set):
v = _wrap_set(v)
elif v is not None and not isinstance(v, AnsibleUnsafe): elif v is not None and not isinstance(v, AnsibleUnsafe):
v = UnsafeProxy(v) v = UnsafeProxy(v)
return v return v

@ -258,13 +258,3 @@
loop: [] loop: []
register: literal_empty_list register: literal_empty_list
failed_when: literal_empty_list is not skipped failed_when: literal_empty_list is not skipped
# https://github.com/ansible/ansible/issues/47372
- name: Loop unsafe list
debug:
var: item
with_items: "{{ things|map('string')|unique }}"
vars:
things:
- !unsafe foo
- !unsafe bar

Loading…
Cancel
Save