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