From 2a4be2748fad885f88163a5b9b1b438fe3cb2ece Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Fri, 30 Nov 2018 07:22:33 -0500 Subject: [PATCH] fixes an issue with dict_merge in network utils (#41107) This change address a problem where the dict_merge function would fail due to the value being a nested dict. This will now recursively pass the value back through the dict_merge function. --- lib/ansible/module_utils/network/common/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/network/common/utils.py b/lib/ansible/module_utils/network/common/utils.py index 4cebe642634..b1dde9685d7 100644 --- a/lib/ansible/module_utils/network/common/utils.py +++ b/lib/ansible/module_utils/network/common/utils.py @@ -301,7 +301,10 @@ def dict_merge(base, other): if key in other: item = other.get(key) if item is not None: - combined[key] = dict_merge(value, other[key]) + if isinstance(other[key], dict): + combined[key] = dict_merge(value, other[key]) + else: + combined[key] = other[key] else: combined[key] = item else: