Skip to content

Commit

Permalink
Fix IOError with gnomekeyring.find_network_password_sync
Browse files Browse the repository at this point in the history
find_network_password_sync throws a gnomekeyring.IOError
when a non-root user tries to run nova client
from a ssh console. If we don't catch this exception nova client
throws the traceback (shown in the bug report) and stops.
If we catch this exception (just like we catch ValueError),
and return None, Nova client executes just fine.

Fixes LP# 1116302

Change-Id: If6937b3f8eafb1dc55224b2ca2bd0f93ae07f8c6
  • Loading branch information
Davanum Srinivas committed Feb 14, 2013
1 parent 67b3db2 commit d1d4f33
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions novaclient/shell.py
Expand Up @@ -33,6 +33,11 @@
try:
import keyring
HAS_KEYRING = True
try:
if isinstance(keyring.get_keyring(), keyring.backend.GnomeKeyring):
_IOError = gnomekeyring.IOError
except Exception:
_IOError = IOError
except ImportError:
pass

Expand Down Expand Up @@ -146,7 +151,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 ValueError:
except (_IOError, ValueError):
pass
return management_url

Expand All @@ -163,7 +168,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 ValueError:
except (_IOError, ValueError):
pass
return token

Expand All @@ -176,7 +181,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 ValueError:
except (_IOError, ValueError):
pass
return tenant_id

Expand Down

0 comments on commit d1d4f33

Please sign in to comment.