From 8be1de454016a86df7b75dc8ad03c56b255db147 Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Thu, 22 Aug 2013 13:39:05 +1200 Subject: [PATCH] Improve error message for nova unknown status The current message is obtuse and fails the zbitter test of good taste. Change-Id: I12b6904f78452a7dedf3265af4930ba0fc6902a1 --- heat/engine/resources/instance.py | 11 +++++------ heat/tests/test_instance.py | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/heat/engine/resources/instance.py b/heat/engine/resources/instance.py index dbb66d13..f2796a6f 100644 --- a/heat/engine/resources/instance.py +++ b/heat/engine/resources/instance.py @@ -311,17 +311,16 @@ class Instance(resource.Resource): fault = getattr(server, 'fault', {}) message = fault.get('message', 'Unknown') code = fault.get('code', 500) - exc = exception.Error(_("Build of server %(server)s failed: " - "%(message)s (%(code)s)") % + exc = exception.Error(_("Creation of server %(server)s " + "failed: %(message)s (%(code)s)") % dict(server=server.name, message=message, code=code)) raise exc else: - exc = exception.Error(_('Nova reported unexpected ' - 'instance[%(name)s] ' - 'status[%(status)s]') % - dict(name=self.name, + exc = exception.Error(_("Creation of server %(server)s failed " + "with unknown status: %(status)s") % + dict(server=server.name, status=server.status)) raise exc else: diff --git a/heat/tests/test_instance.py b/heat/tests/test_instance.py index 91c075a2..cb96e88c 100644 --- a/heat/tests/test_instance.py +++ b/heat/tests/test_instance.py @@ -254,7 +254,7 @@ class InstancesTest(HeatTestCase): (return_server, self.FakeVolumeAttach())) except exception.Error as e: self.assertEqual( - 'Build of server sample-server2 failed: Unknown (500)', + 'Creation of server sample-server2 failed: Unknown (500)', str(e)) else: self.fail('Error not raised') -- 2.45.2