diff options
author | Marc Pujol <kilburn@la3.org> | 2014-05-30 15:47:18 +0200 |
---|---|---|
committer | James Cammarata <jimi@sngx.net> | 2014-06-09 14:11:01 -0500 |
commit | 4dd5eeb1c4e94c5709655f144b3e093ea160885f (patch) | |
tree | 5855cd9c19e4b02fef51d9b382de7085d4b4a137 | |
parent | d8c8c0823ad816e4fc02f49ce024f25e3b7abcc2 (diff) | |
download | ansible-4dd5eeb1c4e94c5709655f144b3e093ea160885f.tar.gz |
Ensure there are no duplicates in the merged/intersected lists
-rw-r--r-- | lib/ansible/utils/__init__.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/ansible/utils/__init__.py b/lib/ansible/utils/__init__.py index 59324eb84e..f066100759 100644 --- a/lib/ansible/utils/__init__.py +++ b/lib/ansible/utils/__init__.py @@ -1006,17 +1006,20 @@ def is_list_of_strings(items): return True def list_union(a, b): - result = list(a) - for i in b: - if i not in result: - result.append(i) + result = [] + for x in a: + if x not in result: + result.append(x) + for x in b: + if x not in result: + result.append(x) return result def list_intersection(a, b): result = [] - for i in a: - if i in b: - result.append(i) + for x in a: + if x in b and x not in result: + result.append(x) return result def safe_eval(expr, locals={}, include_exceptions=False): |