mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Make combine_vars() compatible with Python 3
Fixes TypeError: unsupported operand type(s) for +: 'dict_items' and 'dict_items' on Python 3.
This commit is contained in:
parent
5adcd7054b
commit
54dbfba8f8
2 changed files with 6 additions and 2 deletions
|
@ -32,7 +32,9 @@ def combine_vars(a, b):
|
||||||
if C.DEFAULT_HASH_BEHAVIOUR == "merge":
|
if C.DEFAULT_HASH_BEHAVIOUR == "merge":
|
||||||
return merge_hash(a, b)
|
return merge_hash(a, b)
|
||||||
else:
|
else:
|
||||||
return dict(a.items() + b.items())
|
result = a.copy()
|
||||||
|
result.update(b)
|
||||||
|
return result
|
||||||
|
|
||||||
def merge_hash(a, b):
|
def merge_hash(a, b):
|
||||||
''' recursively merges hash b into a
|
''' recursively merges hash b into a
|
||||||
|
|
|
@ -121,7 +121,9 @@ class VariableManager:
|
||||||
if C.DEFAULT_HASH_BEHAVIOUR == "merge":
|
if C.DEFAULT_HASH_BEHAVIOUR == "merge":
|
||||||
return self._merge_dicts(a, b)
|
return self._merge_dicts(a, b)
|
||||||
else:
|
else:
|
||||||
return dict(a.items() + b.items())
|
result = a.copy()
|
||||||
|
result.update(b)
|
||||||
|
return result
|
||||||
|
|
||||||
def _merge_dicts(self, a, b):
|
def _merge_dicts(self, a, b):
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Reference in a new issue