diff --git a/changelogs/fragments/mathstuff-filter-py3-scope.yaml b/changelogs/fragments/mathstuff-filter-py3-scope.yaml new file mode 100644 index 0000000000..48cacc05d3 --- /dev/null +++ b/changelogs/fragments/mathstuff-filter-py3-scope.yaml @@ -0,0 +1,3 @@ +--- +minor_changes: + - "mattstuff filter - fix py3 scope for unique filter errors" diff --git a/lib/ansible/plugins/filter/mathstuff.py b/lib/ansible/plugins/filter/mathstuff.py index 71cd85ad9c..a0298a6494 100644 --- a/lib/ansible/plugins/filter/mathstuff.py +++ b/lib/ansible/plugins/filter/mathstuff.py @@ -62,12 +62,12 @@ def unique(environment, a, case_sensitive=False, attribute=None): else: c = list(c) except TypeError as e: + error = e _do_fail(e) except Exception as e: + error = e _do_fail(e) display.warning('Falling back to Ansible unique filter as Jinja2 one failed: %s' % to_text(e)) - finally: - error = e if not HAS_UNIQUE or error: diff --git a/test/integration/targets/filters/aliases b/test/integration/targets/filters/aliases index c974298bab..765b70da79 100644 --- a/test/integration/targets/filters/aliases +++ b/test/integration/targets/filters/aliases @@ -1,2 +1 @@ shippable/posix/group2 -skip/rhel8.0