Skip to content

Commit

Permalink
Issue when gnomekeyring is present but not the current backend
Browse files Browse the repository at this point in the history
Issue was identified in the review for the previous
patch for bug 1116302. Took this chance to rename _IOError
to a better name (KeyringIOError)

Change-Id: I321353d519eaebea27617702f92ecafe2052eb8e
  • Loading branch information
Davanum Srinivas committed Feb 15, 2013
1 parent d1d4f33 commit 1324652
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions novaclient/shell.py
Expand Up @@ -35,9 +35,11 @@
HAS_KEYRING = True
try:
if isinstance(keyring.get_keyring(), keyring.backend.GnomeKeyring):
_IOError = gnomekeyring.IOError
KeyringIOError = gnomekeyring.IOError
else:
KeyringIOError = IOError
except Exception:
_IOError = IOError
KeyringIOError = IOError
except ImportError:
pass

Expand Down Expand Up @@ -151,7 +153,7 @@ def management_url(self):
block = keyring.get_password('novaclient_auth', self._make_key())
if block:
_token, management_url, _tenant_id = block.split('|', 2)
except (_IOError, ValueError):
except (KeyringIOError, ValueError):
pass
return management_url

Expand All @@ -168,7 +170,7 @@ def auth_token(self):
block = keyring.get_password('novaclient_auth', self._make_key())
if block:
token, _management_url, _tenant_id = block.split('|', 2)
except (_IOError, ValueError):
except (KeyringIOError, ValueError):
pass
return token

Expand All @@ -181,7 +183,7 @@ def tenant_id(self):
block = keyring.get_password('novaclient_auth', self._make_key())
if block:
_token, _management_url, tenant_id = block.split('|', 2)
except (_IOError, ValueError):
except (KeyringIOError, ValueError):
pass
return tenant_id

Expand Down

0 comments on commit 1324652

Please sign in to comment.