@@ -38,37 +38,16 @@ class ReddwarfHTTPClient(HTTPClient):
3838 """
3939
4040 def __init__ (self , user , apikey , tenant , auth_url , service_name ,
41- service_url = None , timeout = None ):
41+ service_type = None , service_url = None , timeout = None ):
4242 super (ReddwarfHTTPClient , self ).__init__ (user , apikey , tenant ,
43- auth_url , timeout = timeout )
43+ auth_url ,
44+ service_type = service_type ,
45+ timeout = timeout )
4446 self .api_key = apikey
4547 self .tenant = tenant
4648 self .service = service_name
4749 self .management_url = service_url
4850
49- def authenticate (self ):
50- scheme , netloc , path , query , frag = urlparse .urlsplit (self .auth_url )
51- path_parts = path .split ('/' )
52- for part in path_parts :
53- if len (part ) > 0 and part [0 ] == 'v' :
54- self .version = part
55- break
56-
57- # Auth against Keystone version 2.0
58- if self .version == "v2.0" :
59- req_body = {'auth' : {'passwordCredentials' :
60- {'username' : self .user ,
61- 'password' : self .api_key },
62- 'tenantName' : self .tenant }}
63- self ._get_token ("/v2.0/tokens" , req_body )
64- # Auth against Keystone version 1.1
65- elif self .version == "v1.1" :
66- req_body = {'credentials' : {'username' : self .user ,
67- 'key' : self .api_key }}
68- self ._get_token ("/v1.1/auth" , req_body )
69- else :
70- raise NotImplementedError ("Version %s is not supported"
71- % self .version )
7251
7352 def _get_token (self , path , req_body ):
7453 """Set the management url and auth token"""
@@ -114,10 +93,13 @@ class Dbaas(Client):
11493 """
11594
11695 def __init__ (self , username , api_key , tenant = None , auth_url = None ,
117- service_name = 'reddwarf' , service_url = None ):
96+ service_type = 'reddwarf' , service_name = 'Reddwarf Service' ,
97+ service_url = None ):
11898 super (Dbaas , self ).__init__ (self , username , api_key , tenant , auth_url )
11999 self .client = ReddwarfHTTPClient (username , api_key , tenant , auth_url ,
120- service_name , service_url )
100+ service_type = service_type ,
101+ service_name = service_name ,
102+ service_url = service_url )
121103 self .versions = Versions (self )
122104 self .databases = Databases (self )
123105 self .instances = Instances (self )
0 commit comments