]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
heat engine : Compare runtime resolved resource snippets on update
authorSteven Hardy <shardy@redhat.com>
Tue, 26 Feb 2013 14:55:18 +0000 (14:55 +0000)
committerSteven Hardy <shardy@redhat.com>
Wed, 27 Feb 2013 16:17:30 +0000 (16:17 +0000)
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

heat/engine/resource.py

index 6f914a24c72696050ad8213f01136c3fd36c7fc8..0623df377efb5af9964cb730735bf96b27beedd6 100644 (file)
@@ -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):
         '''