From afe920e0ce0b22d62bdbe7e3cfaed807d3a87911 Mon Sep 17 00:00:00 2001 From: Angus Salkeld Date: Tue, 30 Jun 2015 11:15:37 +1000 Subject: [PATCH] Convergence: Fix stack status_reason This is needed to fix the following functional test: test_template_resource.TemplateResourceErrorMessageTest.test_fail Change-Id: I90d6e6f688c214a73c043aa88d0a25fc0b2ebc83 --- heat/engine/worker.py | 10 ++++++---- heat/tests/test_engine_worker.py | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/heat/engine/worker.py b/heat/engine/worker.py index 1103d20068..3e7534c693 100644 --- a/heat/engine/worker.py +++ b/heat/engine/worker.py @@ -178,8 +178,9 @@ class WorkerService(service.Service): current_traversal, data, is_update) return - except exception.ResourceFailure as e: - reason = six.text_type(e) + except exception.ResourceFailure as ex: + reason = 'Resource %s failed: %s' % (stack.action, + six.text_type(ex)) self._handle_resource_failure( cnxt, stack.id, current_traversal, reason) return @@ -195,8 +196,9 @@ class WorkerService(service.Service): current_traversal, data, is_update) return - except exception.ResourceFailure as e: - reason = six.text_type(e) + except exception.ResourceFailure as ex: + reason = 'Resource %s failed: %s' % (stack.action, + six.text_type(ex)) self._handle_resource_failure( cnxt, stack.id, current_traversal, reason) return diff --git a/heat/tests/test_engine_worker.py b/heat/tests/test_engine_worker.py index de0f48c5b8..6299356c77 100644 --- a/heat/tests/test_engine_worker.py +++ b/heat/tests/test_engine_worker.py @@ -203,7 +203,8 @@ class CheckWorkflowUpdateTest(common.HeatTestCase): self.is_update) s = self.stack.load(self.ctx, stack_id=self.stack.id) self.assertEqual((s.UPDATE, s.FAILED), (s.action, s.status)) - self.assertEqual(u'ResourceNotAvailable: resources.A: The Resource (A)' + self.assertEqual('Resource UPDATE failed: ' + 'ResourceNotAvailable: resources.A: The Resource (A)' ' is not available.', s.status_reason) def test_resource_cleanup_failure_sets_stack_state_as_failed( @@ -220,7 +221,8 @@ class CheckWorkflowUpdateTest(common.HeatTestCase): self.is_update) s = self.stack.load(self.ctx, stack_id=self.stack.id) self.assertEqual((s.UPDATE, s.FAILED), (s.action, s.status)) - self.assertEqual(u'ResourceNotAvailable: resources.A: The Resource (A)' + self.assertEqual('Resource UPDATE failed: ' + 'ResourceNotAvailable: resources.A: The Resource (A)' ' is not available.', s.status_reason) def test_resource_update_failure_triggers_rollback_if_enabled(