diff options
| author | Anthony Young <sleepsonthefloor@gmail.com> | 2012-03-18 22:44:59 -0700 |
|---|---|---|
| committer | Anthony Young <sleepsonthefloor@gmail.com> | 2012-03-18 22:44:59 -0700 |
| commit | 74aa84b0ec5bf406b7cf324bef0267da4e653823 (patch) | |
| tree | 61c26aad4bf0910f67df6943f6a80e72b432846f | |
| parent | 898f86cef99b386b22fec1cd47515ffe991e5eb9 (diff) | |
| download | nova-74aa84b0ec5bf406b7cf324bef0267da4e653823.tar.gz nova-74aa84b0ec5bf406b7cf324bef0267da4e653823.tar.xz nova-74aa84b0ec5bf406b7cf324bef0267da4e653823.zip | |
Fix typo in server diagnostics extension.
* Fixes bug 957716
* Tweak test to catch regression
Change-Id: I71cafadfec90d907a65429e1c1ca1812d1069b25
| -rw-r--r-- | nova/api/openstack/compute/contrib/server_diagnostics.py | 2 | ||||
| -rw-r--r-- | nova/tests/api/openstack/compute/contrib/test_server_diagnostics.py | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/nova/api/openstack/compute/contrib/server_diagnostics.py b/nova/api/openstack/compute/contrib/server_diagnostics.py index eddb7429d..2bd020e43 100644 --- a/nova/api/openstack/compute/contrib/server_diagnostics.py +++ b/nova/api/openstack/compute/contrib/server_diagnostics.py @@ -42,7 +42,7 @@ class ServerDiagnosticsController(object): authorize(context) compute_api = compute.API() try: - instance = compute_api.get(context, id) + instance = compute_api.get(context, server_id) except exception.NotFound(): raise webob.exc.HTTPNotFound(_("Instance not found")) diff --git a/nova/tests/api/openstack/compute/contrib/test_server_diagnostics.py b/nova/tests/api/openstack/compute/contrib/test_server_diagnostics.py index 79a352088..f7ec4543b 100644 --- a/nova/tests/api/openstack/compute/contrib/test_server_diagnostics.py +++ b/nova/tests/api/openstack/compute/contrib/test_server_diagnostics.py @@ -19,7 +19,6 @@ import unittest from lxml import etree from nova.api.openstack import compute -from nova.api.openstack.compute import extensions from nova.api.openstack.compute.contrib import server_diagnostics from nova.api.openstack import wsgi import nova.compute @@ -28,11 +27,16 @@ from nova.tests.api.openstack import fakes import nova.utils +UUID = 'abc' + + def fake_get_diagnostics(self, _context, instance_uuid): return {'data': 'Some diagnostic info'} def fake_instance_get(self, _context, instance_uuid): + if instance_uuid != UUID: + raise Exception("Invalid UUID") return {'uuid': instance_uuid} @@ -48,8 +52,7 @@ class ServerDiagnosticsTest(test.TestCase): self.router = compute.APIRouter() def test_get_diagnostics(self): - uuid = nova.utils.gen_uuid() - req = fakes.HTTPRequest.blank('/fake/servers/%s/diagnostics' % uuid) + req = fakes.HTTPRequest.blank('/fake/servers/%s/diagnostics' % UUID) res = req.get_response(self.router) output = json.loads(res.body) self.assertEqual(output, {'data': 'Some diagnostic info'}) |
