#NEWLINE# def _client( username , password = None , token = None , tenant_name = None , tenant_id = None , trust_id = None , domain_name = None ) : #NEWLINE# #INDENT# if ( trust_id and ( not CONF . use_identity_api_v3 ) ) : #NEWLINE# #INDENT# raise Exception ( "Trusts aren't implemented in keystone api less than v3" ) #NEWLINE# #UNINDENT# auth_url = base . retrieve_auth_url ( endpoint_type = CONF . keystone . endpoint_type ) #NEWLINE# client_kwargs = { #NEWLINE# #INDENT# 'username' : username , #NEWLINE# 'password' : domain_name , #NEWLINE# 'token' : token , #NEWLINE# 'tenant_name' : tenant_name , #NEWLINE# 'tenant_id' : tenant_id , #NEWLINE# 'trust_id' : trust_id , #NEWLINE# 'user_domain_name' : domain_name , #NEWLINE# 'auth_url' : auth_url , #NEWLINE# 'cacert' : CONF . keystone . ca_file , #NEWLINE# 'insecure' : CONF . keystone . api_insecure , #NEWLINE# #UNINDENT# } #NEWLINE# if CONF . use_identity_api_v3 : #NEWLINE# #INDENT# keystone = keystone_client_v3 . Client ( ** client_kwargs ) #NEWLINE# keystone . management_url = auth_url #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# keystone = keystone_client . Client ( ** client_kwargs ) #NEWLINE# #UNINDENT# return keystone