Fix IOError with gnomekeyring.find_network_password_sync
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
This commit is contained in:
parent
67b3db2bbc
commit
d1d4f33aca
|
@ -33,6 +33,11 @@ HAS_KEYRING = False
|
|||
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
|
||||
|
||||
|
@ -146,7 +151,7 @@ class SecretsHelper(object):
|
|||
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
|
||||
|
||||
|
@ -163,7 +168,7 @@ class SecretsHelper(object):
|
|||
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
|
||||
|
||||
|
@ -176,7 +181,7 @@ class SecretsHelper(object):
|
|||
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
|
||||
|
||||
|
|
Loading…
Reference in New Issue