Pass the previous stack to StackUpdate
This starts out like the existing stack, but is not stored in the database or updated as the stack update proceeds. This allows the StackUpdate object to store any information that might be relevant to a future rollback. Change-Id: I94f0dd69b5e7818f811c8c0d50566a79b81acba7
This commit is contained in:
parent
3d5ee0e075
commit
f2e9b31a96
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user