Fix cloudpipe keypair creation. Add pipelib tests
Commit ec0a65d81f 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
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user