summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrendan Shephard <bshephar@redhat.com>2022-11-03 11:11:36 +1000
committerBrendan Shephard <bshephar@redhat.com>2022-11-03 15:47:01 +1000
commit56d99bf6589832e24e4b0ca53dd7eb2bb8dccd60 (patch)
treea6d86d867df44e023154a2833d8db302e6c6109d
parentf71308319ad528b1a009c27f64b96e452aa144e4 (diff)
downloadheat-56d99bf6589832e24e4b0ca53dd7eb2bb8dccd60.tar.gz
Improve map_merge logging
Templates can be complex and contain multiple instances of map_merges. Debugging this can be complex, so this change aims to improve the mapping and help users determine where the problem has occured. With this change, instead of just saying an error occured, we will now return the object that the error occurred with and a note about it's type. This will allow for quick identification of what the problem was. Change-Id: I1c4da88029bbf1a3cfb58f5e21da28ec2912f924
-rw-r--r--heat/engine/hot/functions.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/heat/engine/hot/functions.py b/heat/engine/hot/functions.py
index a309392b3..ec4bb9d6d 100644
--- a/heat/engine/hot/functions.py
+++ b/heat/engine/hot/functions.py
@@ -738,7 +738,9 @@ class MapMerge(function.Function):
elif isinstance(m, collections.abc.Mapping):
return m
else:
- msg = _('Incorrect arguments: Items to merge must be maps.')
+ msg = _('Incorrect arguments: Items to merge must be maps. '
+ '{} is type {} instead of a dict'.format(
+ repr(m)[:200], type(m)))
raise TypeError(msg)
ret_map = {}