diff options
author | Rakesh H S <rh-s@hp.com> | 2015-09-14 18:22:24 +0530 |
---|---|---|
committer | Rakesh H S <rh-s@hp.com> | 2015-09-18 18:11:30 +0530 |
commit | e06903d9ab4c7fac9ae4b6faa2727f4e8ae4028e (patch) | |
tree | 42a7ddaf7f61292539cea95df3d3dc3226f3edec /heat/engine/resource.py | |
parent | 43660849b5e8617ff664a528f1a738c793727253 (diff) | |
download | heat-e06903d9ab4c7fac9ae4b6faa2727f4e8ae4028e.tar.gz |
Convergence: Assign current_template_id when resource fails
When a resource was being updated and a failure occurs, we are not
setting the rsrc.current_template_id.
The rsrc.current_template_id should also be set when resource failure
occurs, since it was acted upon using the current template.
Change-Id: I5dfda012f36a05691af8fc490560bf9fca043662
Closes-bug: #1495363
Diffstat (limited to 'heat/engine/resource.py')
-rw-r--r-- | heat/engine/resource.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/heat/engine/resource.py b/heat/engine/resource.py index 9e80c190f..780be3f4f 100644 --- a/heat/engine/resource.py +++ b/heat/engine/resource.py @@ -869,19 +869,24 @@ class Resource(object): resource's requires to list of the required resource id from the given resource_data and existing resource's requires. ''' - with self.lock(engine_id): - new_temp = template.Template.load(self.context, template_id) - new_res_def = new_temp.resource_definitions(self.stack)[self.name] - runner = scheduler.TaskRunner(self.update, new_res_def) - runner(timeout=timeout) - - # update the resource db record (stored in unlock) + def update_tmpl_id_and_requires(): self.current_template_id = template_id self.requires = list( set(data[u'id'] for data in resource_data.values() if data is not None) ) + with self.lock(engine_id): + new_temp = template.Template.load(self.context, template_id) + new_res_def = new_temp.resource_definitions(self.stack)[self.name] + runner = scheduler.TaskRunner(self.update, new_res_def) + try: + runner(timeout=timeout) + update_tmpl_id_and_requires() + except exception.ResourceFailure: + update_tmpl_id_and_requires() + raise + @scheduler.wrappertask def update(self, after, before=None, prev_resource=None): ''' |