File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121import tempfile
2222import time
2323
24- import adal
2524import google .auth
2625import google .auth .transport .requests
2726import oauthlib .oauth2
3635from .config_exception import ConfigException
3736from .dateutil import UTC , format_rfc3339 , parse_rfc3339
3837
38+ try :
39+ import adal
40+ except ImportError :
41+ pass
42+
3943EXPIRY_SKEW_PREVENTION_DELAY = datetime .timedelta (minutes = 5 )
4044KUBE_CONFIG_DEFAULT_LOCATION = os .environ .get ('KUBECONFIG' , '~/.kube/config' )
4145_temp_files = {}
@@ -218,6 +222,9 @@ def _load_azure_token(self, provider):
218222 return self .token
219223
220224 def _refresh_azure_token (self , config ):
225+ if 'adal' not in globals ():
226+ raise ImportError ('refresh token error, adal library not imported' )
227+
221228 tenant = config ['tenant-id' ]
222229 authority = 'https://login.microsoftonline.com/{}' .format (tenant )
223230 context = adal .AuthenticationContext (
You can’t perform that action at this time.
0 commit comments