summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorDan Prince <dprince@redhat.com>2012-08-15 12:34:30 -0400
committerVishvananda Ishaya <vishvananda@gmail.com>2012-08-16 16:57:57 -0700
commit06d1f0dfd5d22ace96b414fd0b71fbaa668b95ce (patch)
tree5158241240bee346dd43bb06ab0916b14eba66b6 /nova/api
parent12257fa089686ac3ca6a11a7c262b8f0f0dcf8ca (diff)
downloadnova-06d1f0dfd5d22ace96b414fd0b71fbaa668b95ce.tar.gz
nova-06d1f0dfd5d22ace96b414fd0b71fbaa668b95ce.tar.xz
nova-06d1f0dfd5d22ace96b414fd0b71fbaa668b95ce.zip
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
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/contrib/keypairs.py9
1 files changed, 9 insertions, 0 deletions
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):
"""