def __init__(self, path, config, provider):
   self.logger = logger.Logger(name='compute-auth')
   self.watcher = metadata_watcher.MetadataWatcher(logger=self.logger)
   self.service_account = config.get('GoogleCompute', 'service_account', '')
   self.scopes = None
   if provider.name == 'google' and self.service_account:
     self.scopes = self._GetGsScopes()
   if not self.scopes:
     raise auth_handler.NotReadyToAuthenticate()
Exemplo n.º 2
0
 def __init__(self, path, config, provider):
     self.oauth2_client = None
     if (provider.name == 'google'):
         if config.has_option('GoogleCompute', 'service_account'):
             self.oauth2_client = oauth2_client.CreateOAuth2GCEClient()
         else:
             self.oauth2_client = oauth2_helper.OAuth2ClientFromBotoConfig(config)
             self.oauth2_client.cache_key_base = oauth.CLIENT_ID
     if not self.oauth2_client:
         raise auth_handler.NotReadyToAuthenticate()