Re-resolve functions during stack update

Functions in new resources must be resolved again to refer to the new stack
in which they are to be inserted.

Change-Id: I0f986d3042fb70aa0bb7b8f0e2c514baa212ba1f
This commit is contained in:
Zane Bitter 2014-02-17 16:51:39 -05:00
parent 3fd4da64b6
commit ca819d0bb3
2 changed files with 9 additions and 3 deletions

View File

@ -260,6 +260,7 @@ class Stack(collections.Mapping):
def __setitem__(self, key, resource):
'''Set the resource with the specified name to a specific value.'''
resource.stack = self
resource.reparse()
self.resources[key] = resource
def __delitem__(self, key):

View File

@ -13,6 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import copy
from heat.db import api as db_api
from heat.engine import dependencies
@ -142,11 +144,14 @@ class StackUpdate(object):
yield self._create_resource(new_res)
def _update_in_place(self, existing_res, new_res):
existing_snippet = self.existing_snippets[existing_res.name]
prev_res = self.previous_stack.get(new_res.name)
# Note the new resource snippet is resolved in the context
# of the existing stack (which is the stack being updated)
existing_snippet = self.existing_snippets[existing_res.name]
new_snippet = self.existing_stack.resolve_runtime_data(new_res.t)
prev_res = self.previous_stack.get(new_res.name)
raw_snippet = copy.deepcopy(new_res.t)
parsed_snippet = self.existing_stack.resolve_static_data(raw_snippet)
new_snippet = self.existing_stack.resolve_runtime_data(parsed_snippet)
return existing_res.update(new_snippet, existing_snippet,
prev_resource=prev_res)