ServerError is being incorrectly used to report an internal error
leading to an error formatting the response, as there's no body
specified to the format string. Use exception.Error instead and
adjust the message to make the user-visible response clearer.
Fixes bug #
1214457
Change-Id: I83435686170c4f40658968a35f1faa303f50f4a4
from heat.openstack.common import log as logging
from heat.openstack.common.gettextutils import _
-from heat.common.exception import ServerError
from heat.common.exception import StackValidationFailed
logger = logging.getLogger(__name__)
for res in self:
try:
result = res.validate()
- except ServerError as ex:
+ except exception.Error as ex:
logger.exception(ex)
raise ex
except Exception as ex:
try:
image_list = nova_client.images.list()
except clients.novaclient.exceptions.ClientException as ex:
- raise exception.ServerError(message=str(ex))
+ raise exception.Error(
+ message="Error retrieving image list from nova: %s" % str(ex))
image_names = dict(
(o.id, o.name)
for o in image_list if o.name == image_identifier)
instances.Instance.nova().AndReturn(self.fc)
self.m.ReplayAll()
- self.assertRaises(exception.ServerError,
- stack.validate)
+ self.assertRaises(exception.Error, stack.validate)
self.m.VerifyAll()
def test_validate_unique_logical_name(self):