summaryrefslogtreecommitdiffstats
path: root/nova/cloudpipe
diff options
context:
space:
mode:
authorAlvaro Lopez Garcia <aloga@ifca.unican.es>2012-07-19 14:49:41 +0200
committerAlvaro Lopez Garcia <aloga@ifca.unican.es>2012-07-19 16:46:43 +0200
commit8b7765276951f4a2a6a80df3bce7c12e64cee44f (patch)
tree9e520002470e0bbcce8f73a3af2659fea00ab02b /nova/cloudpipe
parent8d06ad4605457f909ed7f0cdfc7480b03e1a01b2 (diff)
downloadnova-8b7765276951f4a2a6a80df3bce7c12e64cee44f.tar.gz
nova-8b7765276951f4a2a6a80df3bce7c12e64cee44f.tar.xz
nova-8b7765276951f4a2a6a80df3bce7c12e64cee44f.zip
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
Diffstat (limited to 'nova/cloudpipe')
-rw-r--r--nova/cloudpipe/pipelib.py7
1 files changed, 4 insertions, 3 deletions
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):