kolla-build: Wrap tpl_dict.keys() in a list()

In python 3, tpl_dict.keys() returns a dict_keys object that does not
support indexing and is then indexed.
Wrap tpl_dict.keys() in a list() so it can be be indexed in python 2 and
3.

Change-Id: I17e3bbfc4eeba58e4bdd7fdd1ecdb21baa5c4461
Closes-Bug: 1778781
(cherry picked from commit 96ca4c2f2c)
This commit is contained in:
Martin Chlumsky 2018-06-26 16:18:10 -04:00
parent fef8e66b47
commit 858ebd84c6
1 changed files with 1 additions and 1 deletions

View File

@ -766,7 +766,7 @@ class KollaWorker(object):
template = env.get_template(tpl_path)
if self.conf.template_override:
tpl_dict = self._merge_overrides(self.conf.template_override)
template_name = os.path.basename(tpl_dict.keys()[0])
template_name = os.path.basename(list(tpl_dict.keys())[0])
values['parent_template'] = template
env = jinja2.Environment( # nosec: not used to render HTML
loader=jinja2.DictLoader(tpl_dict))