From 06d1f0dfd5d22ace96b414fd0b71fbaa668b95ce Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Wed, 15 Aug 2012 12:34:30 -0400 Subject: Implement GET (show) in OS API keypairs extension. Includes test for showing a keypair (existing and non-existing). This commit also corrects the name of the KeyPairNotFound exception in the test_keypair_delete_not_found test case. Additionally some extra print statements in the tests were removed. DocImpact - need to add documentation for GET on: v2/{tenant_id}/os-keypairs/{keypair_name} Fixes LP Bug #925731. Change-Id: I9eeb47ccb9bf352c554aa44aa562c47e3eb33cae --- nova/api/openstack/compute/contrib/keypairs.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'nova/api') diff --git a/nova/api/openstack/compute/contrib/keypairs.py b/nova/api/openstack/compute/contrib/keypairs.py index db503ffdd..ab264f9da 100644 --- a/nova/api/openstack/compute/contrib/keypairs.py +++ b/nova/api/openstack/compute/contrib/keypairs.py @@ -108,6 +108,15 @@ class KeypairController(object): raise webob.exc.HTTPNotFound() return webob.Response(status_int=202) + @wsgi.serializers(xml=KeypairTemplate) + def show(self, req, id): + """Return data for the given key name.""" + context = req.environ['nova.context'] + authorize(context) + + keypair = self.api.get_key_pair(context, context.user_id, id) + return {'keypair': keypair} + @wsgi.serializers(xml=KeypairsTemplate) def index(self, req): """ -- cgit