Skip to content

Instantly share code, notes, and snippets.

@anteaya
Created January 16, 2013 18:17
Show Gist options
  • Save anteaya/4549374 to your computer and use it in GitHub Desktop.
Save anteaya/4549374 to your computer and use it in GitHub Desktop.
301 def authenticate(self):
302 if has_keyring:
303 keys = [self.auth_url, self.projectid, self.user, self.region_name,
304 self.endpoint_type, self.service_type, self.service_name,
305 self.volume_service_name]
306 for index, key in enumerate(keys):
307 if key is None:
308 keys[index] = '?'
309 keyring_key = "/".join(keys)
310 if self.os_cache and not self.used_keyring:
311 # Lookup the token/mgmt url from the keyring first time
312 # through.
313 # If we come through again, it's because the old token
314 # was rejected.
315 try:
316 block = keyring.get_password("novaclient_auth",
317 keyring_key)
318 if block:
319 self.used_keyring = True
320 self.auth_token, self.management_url = block.split('|')
321 return
322 except Exception:
323 pass
324
325 magic_tuple = urlparse.urlsplit(self.auth_url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment