22import os
33import logging
44
5- import keystoneclient
6- import keystoneauth1
7- import glanceclient
8- import novaclient
5+ import keystoneclient .auth .identity
6+ import keystoneclient .client
7+ import keystoneauth1 .session
8+ import keystoneauth1 .identity .v3
9+
10+ import glanceclient .client
11+ import novaclient .client
912
1013
1114class OpenstackAuthenticator :
1215 def __init__ (self ):
1316 self .auth_url = os .getenv ("OS_AUTH_URL" )
1417
15- @abc .abstractmethod
1618 def authenticate (self ):
1719 self .session = keystoneauth1 .session .Session (auth = self ._auth ())
18- keystoneauth1 .session .Session
20+ # get a keystone client
21+ #self.kc = keystoneclient.client.Client("3", session=self.session, auth_url=self.session.auth.auth_url)
22+ self .kc = keystoneclient .client .Client (session = self .session )
1923
2024 @abc .abstractmethod
2125 def _auth (self ):
@@ -58,10 +62,7 @@ def _auth(self):
5862 def authenticate (self ):
5963 super ().authenticate ()
6064
61- # get a keystone client
62- self .kc = keystoneclient .client .Client ("3" , session = self .session , auth_url = self .session .auth .auth_url )
63-
64- # and authenticate it
65+ # and authenticate the client
6566 self .kc .authenticate (
6667 token = self .sess .get_auth_headers ()["X-Auth-Token" ],
6768 project_id = self .session .get_project_id (),
@@ -84,12 +85,6 @@ def _auth(self):
8485 auth_url = self .auth_url ,
8586 auth_methods = [application_credential ]
8687 )
87-
88- def authenticate (self ):
89- super ().authenticate ()
90-
91- # get a keystone client
92- self .kc = keystoneclient .v3 .client .Client (session = self .session )
9388
9489
9590class AuthenticatedClient ():
0 commit comments