From 8b7765276951f4a2a6a80df3bce7c12e64cee44f Mon Sep 17 00:00:00 2001 From: Alvaro Lopez Garcia Date: Thu, 19 Jul 2012 14:49:41 +0200 Subject: Fix cloudpipe keypair creation. Add pipelib tests Commit ec0a65d81fd11d26be77b45827a4dd7c77711675 introduced a new internal key pair API, removing the _gen_key() method from the EC2 API. pipelib.py used this method so as to generate the keypair of the cloudpipe instance. This commit also adds unittests for pipelib.py, thus fixes bug 828588 Change-Id: I0884289bac01ac5109dde4bdee5af55e7bfd5aa2 --- nova/cloudpipe/pipelib.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'nova/cloudpipe') diff --git a/nova/cloudpipe/pipelib.py b/nova/cloudpipe/pipelib.py index 6926978fc..6a772eb63 100644 --- a/nova/cloudpipe/pipelib.py +++ b/nova/cloudpipe/pipelib.py @@ -26,8 +26,6 @@ import os import string import zipfile -# NOTE(vish): cloud is only for the _gen_key functionality -from nova.api.ec2 import cloud from nova import compute from nova.compute import instance_types from nova import crypto @@ -146,7 +144,10 @@ class CloudPipe(object): def setup_key_pair(self, context): key_name = '%s%s' % (context.project_id, FLAGS.vpn_key_suffix) try: - result = cloud._gen_key(context, context.user_id, key_name) + keypair_api = compute.api.KeypairAPI() + result = keypair_api.create_key_pair(context, + context.user_id, + key_name) private_key = result['private_key'] key_dir = os.path.join(FLAGS.keys_path, context.user_id) if not os.path.exists(key_dir): -- cgit