heat engine : Compare runtime resolved resource snippets on update
We need to compare the runtime resolved resource snippet, since that is what we get back from self.parsed_template. If we don't do this, then we get a false positive when a Ref to a parameter which gets updated (e.g AWS::StackId) is used in the resource properties. ref bug 1131666 Change-Id: Ib488c43b9eca998a7a82b7571097f5bb69ef946c
This commit is contained in:
parent
79bc8170a0
commit
f4fcb7bd5a
|
@ -192,21 +192,22 @@ class Resource(object):
|
|||
update_allowed_set = set(self.update_allowed_keys)
|
||||
|
||||
# Create a set containing the keys in both current and update template
|
||||
current_snippet = self.parsed_template()
|
||||
template_keys = set(current_snippet.keys())
|
||||
template_keys.update(set(json_snippet.keys()))
|
||||
current_template = self.parsed_template()
|
||||
template_keys = set(current_template.keys())
|
||||
new_template = self.stack.resolve_runtime_data(json_snippet)
|
||||
template_keys.update(set(new_template.keys()))
|
||||
|
||||
# Create a set of keys which differ (or are missing/added)
|
||||
changed_keys_set = set([k for k in template_keys
|
||||
if current_snippet.get(k) !=
|
||||
json_snippet.get(k)])
|
||||
if current_template.get(k) !=
|
||||
new_template.get(k)])
|
||||
|
||||
if not changed_keys_set.issubset(update_allowed_set):
|
||||
badkeys = changed_keys_set - update_allowed_set
|
||||
raise NotImplementedError("Cannot update keys %s for %s" %
|
||||
(badkeys, self.name))
|
||||
|
||||
return dict((k, json_snippet.get(k)) for k in changed_keys_set)
|
||||
return dict((k, new_template.get(k)) for k in changed_keys_set)
|
||||
|
||||
def update_template_diff_properties(self, json_snippet=None):
|
||||
'''
|
||||
|
|
Loading…
Reference in New Issue