Fix the keystone authentication issue

Change-Id: Iaada4fba2b331b2f0776936925bc17d7d3de3e4a
This commit is contained in:
Yichen Wang 2015-11-19 15:08:02 -08:00
parent 97874b246f
commit 3d25fa06b0
3 changed files with 5 additions and 10 deletions

View File

@ -50,7 +50,7 @@ def create_keystone_client(creds):
Return the keystone client and auth URL given a credential
"""
creds = creds.get_credentials()
return (keystoneclient.Client(**creds), creds['auth_url'])
return (keystoneclient.Client(endpoint_type='publicURL', **creds), creds['auth_url'])
class Kloud(object):
def __init__(self, scale_cfg, cred, reusing_tenants, testing_side=False):

View File

@ -44,12 +44,7 @@ class Tenant(object):
LOG.info("Using tenant: " + self.tenant_name)
# Only admin can retrive the object via Keystone API
self.tenant_object = None
try:
# Try to see if we have the admin access to retrive the tenant id using
# tenant name directly from keystone
self.tenant_id = self.kloud.keystone.tenants.find(name=self.tenant_name).id
except Exception:
self.tenant_id = self.kloud.keystone.tenant_id
self.tenant_id = self.kloud.keystone.tenant_id
self.tenant_quota = tenant_quota
self.reusing_users = reusing_users

View File

@ -197,7 +197,7 @@ class User(object):
creden['tenant_name'] = self.tenant.tenant_name
# Create the neutron client to be used for all operations
self.neutron_client = neutronclient.Client(**creden)
self.neutron_client = neutronclient.Client(endpoint_type='publicURL', **creden)
# Create a new nova and cinder client for this User with correct credentials
creden_nova = {}
@ -207,8 +207,8 @@ class User(object):
creden_nova['project_id'] = self.tenant.tenant_name
creden_nova['version'] = 2
self.nova_client = Client(**creden_nova)
self.cinder_client = cinderclient.Client(**creden_nova)
self.nova_client = Client(endpoint_type='publicURL', **creden_nova)
self.cinder_client = cinderclient.Client(endpoint_type='publicURL', **creden_nova)
if self.tenant.kloud.reusing_tenants:
self.check_resources_quota()