Allow iteration over files dict before template stored

Due to a programming error, the files dict of a template would appear to
contain no items when iterated over prior to them being stored in the
database. (Individual items could still be accessed directly by name.)
Since this is the mechanism by which dictionaries are serialised (directly
or e.g. via items()), this resulted in an empty files dict when trying to
send the data over ReST. (The same is likely true of RPC, but we don't
generally send the files dict over RPC any more.)

Since validation occurs before the template is stored, this meant that we
could not validate a remote stack over ReST.

Change-Id: Ie7433557321c54075ad531def0247fad735d07d9
Closes-Bug: #1739447
changes/72/538372/1
Zane Bitter 5 years ago
parent f20c0db8aa
commit b652926eb5
  1. 2
      heat/engine/template_files.py

@ -76,7 +76,7 @@ class TemplateFiles(collections.Mapping):
def __iter__(self):
self._refresh_if_needed()
if self.files_id is None:
if self.files is None:
return iter(ReadOnlyDict({}))
return iter(self.files)

Loading…
Cancel
Save