From: Zane Bitter Date: Mon, 26 Aug 2013 19:11:59 +0000 (+0200) Subject: Add a "rollback" parameter to StackUpdate X-Git-Tag: 2014.1~128^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=83bbb975cab56ffa452e41ccfe9e965b939b66e6;p=openstack-build%2Fheat-build.git Add a "rollback" parameter to StackUpdate We can only consider restoring backup resources during a rollback operation. If they are present during a standard update, there is no way of testing whether or not they match the new template definition, so we need to treat them differently in this case. Change-Id: Ibd73ed047486c253a6c06b7340a3a591f0fee3db --- diff --git a/heat/engine/parser.py b/heat/engine/parser.py index 8ee8dc89..99e984ea 100644 --- a/heat/engine/parser.py +++ b/heat/engine/parser.py @@ -410,7 +410,8 @@ class Stack(object): backup_stack = self._backup_stack() try: - update_task = update.StackUpdate(self, newstack, backup_stack) + update_task = update.StackUpdate(self, newstack, backup_stack, + rollback=action == self.ROLLBACK) updater = scheduler.TaskRunner(update_task) self.env = newstack.env diff --git a/heat/engine/update.py b/heat/engine/update.py index 5e44a507..9ccbef5d 100644 --- a/heat/engine/update.py +++ b/heat/engine/update.py @@ -26,17 +26,23 @@ class StackUpdate(object): A Task to perform the update of an existing stack to a new template. """ - def __init__(self, existing_stack, new_stack, previous_stack): + def __init__(self, existing_stack, new_stack, previous_stack, + rollback=False): """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.rollback = rollback + self.existing_snippets = dict((r.name, r.parsed_template()) for r in self.existing_stack) def __repr__(self): - return '%s Update' % str(self.existing_stack) + if self.rollback: + return '%s Rollback' % str(self.existing_stack) + else: + return '%s Update' % str(self.existing_stack) @scheduler.wrappertask def __call__(self):