Incorrect merging of lists in template files

Change-Id: I884104f92304ea1fb9a538469f3c011ac15834e6
This commit is contained in:
Stan Lagun 2013-07-10 15:38:24 +04:00
parent 9fd4ebece2
commit 87c66644e8
3 changed files with 12 additions and 2 deletions

View File

@ -14,6 +14,7 @@
# limitations under the License.
import types
import deep
def transform_json(json, mappings):
@ -42,7 +43,16 @@ def transform_json(json, mappings):
def merge_lists(list1, list2):
return list1 + list2
result = []
for item in list1 + list2:
exists = False
for old_item in result:
if deep.diff(item, old_item) is None:
exists = True
break
if not exists:
result.append(item)
return result
def merge_dicts(dict1, dict2, max_levels=0):

View File

@ -9,3 +9,4 @@ python-heatclient
#http://tarballs.openstack.org/oslo-config/oslo-config-2013.1b4.tar.gz#egg=oslo-config
oslo.config
deep

View File

@ -7,4 +7,3 @@ nosexcover
pep8
sphinx>=1.1.2
mockfs
deep