From: Steven Hardy Date: Tue, 26 Feb 2013 14:55:18 +0000 (+0000) Subject: heat engine : Compare runtime resolved resource snippets on update X-Git-Tag: 2014.1~846^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=f4fcb7bd5ae3345555f1ac8fdbad2fe84408c0a5;p=openstack-build%2Fheat-build.git 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 --- diff --git a/heat/engine/resource.py b/heat/engine/resource.py index 6f914a24..0623df37 100644 --- a/heat/engine/resource.py +++ b/heat/engine/resource.py @@ -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): '''