Add keystone v2 keypair methods
To get KeystoneClientV2 to work with StackUser resources, the missing methods create_stack_domain_user_keypair and delete_stack_domain_user_keypair have been added. StackUser._create_keypair has also been modified to tolerate having a missing id attribute, which is what the v2 API returns. Change-Id: I9c19c1ca49f72ff1e760e849712c8c9d5fa7541f Closes-Bug: #1372687
This commit is contained in:
parent
299f8a6639
commit
d9eebfdbc6
@ -223,6 +223,13 @@ class KeystoneClientV2(object):
|
|||||||
'''Pass through method since no project was created.'''
|
'''Pass through method since no project was created.'''
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def create_stack_domain_user_keypair(self, user_id, project_id):
|
||||||
|
return self.create_ec2_keypair(user_id)
|
||||||
|
|
||||||
|
def delete_stack_domain_user_keypair(self, user_id, project_id,
|
||||||
|
credential_id):
|
||||||
|
return self.delete_ec2_keypair(user_id, credential_id)
|
||||||
|
|
||||||
# ###################### #
|
# ###################### #
|
||||||
# V3 Unsupported Methods #
|
# V3 Unsupported Methods #
|
||||||
# ###################### #
|
# ###################### #
|
||||||
|
@ -132,7 +132,13 @@ class StackUser(resource.Resource):
|
|||||||
raise exception.Error(_("Error creating ec2 keypair for user %s") %
|
raise exception.Error(_("Error creating ec2 keypair for user %s") %
|
||||||
user_id)
|
user_id)
|
||||||
else:
|
else:
|
||||||
self.data_set('credential_id', kp.id, redact=True)
|
try:
|
||||||
|
credential_id = kp.id
|
||||||
|
except AttributeError:
|
||||||
|
# keystone v2 keypairs do not have an id attribute. Use the
|
||||||
|
# access key instead.
|
||||||
|
credential_id = kp.access
|
||||||
|
self.data_set('credential_id', credential_id, redact=True)
|
||||||
self.data_set('access_key', kp.access, redact=True)
|
self.data_set('access_key', kp.access, redact=True)
|
||||||
self.data_set('secret_key', kp.secret, redact=True)
|
self.data_set('secret_key', kp.secret, redact=True)
|
||||||
return kp
|
return kp
|
||||||
|
Loading…
Reference in New Issue
Block a user