Comment 7 for bug 1819737

Revision history for this message
Harald Jensås (harald-jensas) wrote :

@lmiccini - Would this fix it?

diff --git a/tripleoclient/utils.py b/tripleoclient/utils.py
index 066e74ce..0b0c13de 100644
--- a/tripleoclient/utils.py
+++ b/tripleoclient/utils.py
@@ -901,7 +901,9 @@ def replace_links_in_template(template_part, link_replacement):
         return {k: replaced_dict_value(k, v)
                 for k, v in six.iteritems(template_part)}
     elif isinstance(template_part, list):
- return map(replaced_list_value, template_part)
+ # NOTE(hjensas): If the list have no items there is nothing to replace.
+ if template_part:
+ return map(replaced_list_value, template_part)
     else:
         return template_part

If I get it right we are doing some recursive function calling, trying to find dicts with 'get_file' or 'type' and replace things based on link_replacement. If the template_part is a list, and it's empty there is nothing to replace. So we can simply return the template_part?