Merge "Pass the previous stack to StackUpdate"
This commit is contained in:
@@ -383,16 +383,17 @@ class Stack(object):
|
||||
'State invalid for %s' % action)
|
||||
return
|
||||
|
||||
current_env = self.env
|
||||
self.env = newstack.env
|
||||
self.parameters = newstack.parameters
|
||||
|
||||
self.state_set(self.UPDATE, self.IN_PROGRESS,
|
||||
'Stack %s started' % action)
|
||||
|
||||
oldstack = Stack(self.context, self.name, self.t, self.env)
|
||||
try:
|
||||
update_task = update.StackUpdate(self, newstack)
|
||||
update_task = update.StackUpdate(self, newstack, oldstack)
|
||||
updater = scheduler.TaskRunner(update_task)
|
||||
|
||||
self.env = newstack.env
|
||||
self.parameters = newstack.parameters
|
||||
|
||||
try:
|
||||
updater(timeout=self.timeout_secs())
|
||||
finally:
|
||||
@@ -416,8 +417,6 @@ class Stack(object):
|
||||
# If rollback is enabled, we do another update, with the
|
||||
# existing template, so we roll back to the original state
|
||||
if not self.disable_rollback:
|
||||
oldstack = Stack(self.context, self.name, self.t,
|
||||
current_env)
|
||||
self.update(oldstack, action=self.ROLLBACK)
|
||||
return
|
||||
|
||||
|
||||
@@ -26,10 +26,11 @@ class StackUpdate(object):
|
||||
A Task to perform the update of an existing stack to a new template.
|
||||
"""
|
||||
|
||||
def __init__(self, existing_stack, new_stack):
|
||||
def __init__(self, existing_stack, new_stack, previous_stack):
|
||||
"""Initialise with the existing stack and the new stack."""
|
||||
self.existing_stack = existing_stack
|
||||
self.new_stack = new_stack
|
||||
self.previous_stack = previous_stack
|
||||
|
||||
self.existing_snippets = dict((r.name, r.parsed_template())
|
||||
for r in self.existing_stack)
|
||||
|
||||
Reference in New Issue
Block a user