diff options
-rw-r--r-- | heat/engine/hot/functions.py | 14 | ||||
-rw-r--r-- | heat/tests/test_hot.py | 2 |
2 files changed, 9 insertions, 7 deletions
diff --git a/heat/engine/hot/functions.py b/heat/engine/hot/functions.py index cf4eaa0f5..2575264c9 100644 --- a/heat/engine/hot/functions.py +++ b/heat/engine/hot/functions.py @@ -1603,12 +1603,14 @@ class ListConcat(function.Function): for m in args: ret_list.extend(ensure_list(m)) - if self._unique: - for i in ret_list: - while ret_list.count(i) > 1: - del ret_list[ret_list.index(i)] - - return ret_list + if not self._unique: + return ret_list + + unique_list = [] + for item in ret_list: + if item not in unique_list: + unique_list.append(item) + return unique_list class ListConcatUnique(ListConcat): diff --git a/heat/tests/test_hot.py b/heat/tests/test_hot.py index 753123921..702ca1a1f 100644 --- a/heat/tests/test_hot.py +++ b/heat/tests/test_hot.py @@ -2367,7 +2367,7 @@ resources: self.assertEqual(snippet_resolved, resolved) def test_list_concat_unique(self): - snippet = {'list_concat_unique': [['v1', 'v2'], ['v2', 'v3']]} + snippet = {'list_concat_unique': [['v1', 'v2'], ['v1', 'v3']]} snippet_resolved = ['v1', 'v2', 'v3'] tmpl = template.Template(hot_pike_tpl_empty) resolved = self.resolve(snippet, tmpl) |