From 9ce657702cbc4312669f364e68b0c1faefd0f0af Mon Sep 17 00:00:00 2001 From: daisy-ycguo Date: Thu, 14 Jun 2012 10:32:21 +0800 Subject: bug #996880 change HostNotFound in hosts to HTTPNotFound Change-Id: Ib8b7f1f26c2370e2a82b491d8774797985c0ae98 --- nova/api/openstack/compute/contrib/hosts.py | 3 ++- nova/tests/api/openstack/compute/contrib/test_hosts.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/nova/api/openstack/compute/contrib/hosts.py b/nova/api/openstack/compute/contrib/hosts.py index e9d342c53..6cdca56c8 100644 --- a/nova/api/openstack/compute/contrib/hosts.py +++ b/nova/api/openstack/compute/contrib/hosts.py @@ -114,7 +114,8 @@ def check_host(fn): if id in hosts: return fn(self, req, id, *args, **kwargs) else: - raise exception.HostNotFound(host=id) + message = _("Host '%s' could not be found.") % id + raise webob.exc.HTTPNotFound(explanation=message) return wrapped diff --git a/nova/tests/api/openstack/compute/contrib/test_hosts.py b/nova/tests/api/openstack/compute/contrib/test_hosts.py index ae5c39e75..2e4064c21 100644 --- a/nova/tests/api/openstack/compute/contrib/test_hosts.py +++ b/nova/tests/api/openstack/compute/contrib/test_hosts.py @@ -182,7 +182,7 @@ class HostTestCase(test.TestCase): self.assertEqual(result["maintenance_mode"], "on_maintenance") def test_bad_host(self): - self.assertRaises(exception.HostNotFound, self.controller.update, + self.assertRaises(webob.exc.HTTPNotFound, self.controller.update, self.req, "bogus_host_name", body={"status": "disable"}) def test_show_forbidden(self): -- cgit