Make compute_api use KeyPair objects

This makes compute_api's KeypairAPI use KeyPair objects to do
its work. Most of the change here is to tests to account for the
change.

Related to blueprint compute-api-objects

Change-Id: If516a88eac107670d9ae37fcfaf56f2add9dd0c5
This commit is contained in:
Dan Smith
2013-08-14 11:30:30 -07:00
parent e91c6ffbea
commit 28e937cd2b
11 changed files with 113 additions and 79 deletions

View File

@@ -171,10 +171,9 @@ class CloudPipe(object):
key_name = '%s%s' % (context.project_id, CONF.vpn_key_suffix)
try:
keypair_api = compute.api.KeypairAPI()
result = keypair_api.create_key_pair(context,
context.user_id,
key_name)
private_key = result['private_key']
result, private_key = keypair_api.create_key_pair(context,
context.user_id,
key_name)
key_dir = os.path.join(CONF.keys_path, context.user_id)
fileutils.ensure_tree(key_dir)
key_path = os.path.join(key_dir, '%s.pem' % key_name)