Merge "catch NoKeyringDaemonError from gnomekeyring"
This commit is contained in:
commit
0aa6200544
@ -31,17 +31,18 @@ import pkgutil
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
HAS_KEYRING = False
|
HAS_KEYRING = False
|
||||||
|
all_errors = ValueError
|
||||||
try:
|
try:
|
||||||
import keyring
|
import keyring
|
||||||
HAS_KEYRING = True
|
HAS_KEYRING = True
|
||||||
try:
|
try:
|
||||||
if isinstance(keyring.get_keyring(), keyring.backend.GnomeKeyring):
|
if isinstance(keyring.get_keyring(), keyring.backend.GnomeKeyring):
|
||||||
import gnomekeyring
|
import gnomekeyring
|
||||||
KeyringIOError = gnomekeyring.IOError
|
all_errors = (ValueError,
|
||||||
else:
|
gnomekeyring.IOError,
|
||||||
KeyringIOError = IOError
|
gnomekeyring.NoKeyringDaemonError)
|
||||||
except Exception:
|
except Exception:
|
||||||
KeyringIOError = IOError
|
pass
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -157,7 +158,7 @@ class SecretsHelper(object):
|
|||||||
block = keyring.get_password('novaclient_auth', self._make_key())
|
block = keyring.get_password('novaclient_auth', self._make_key())
|
||||||
if block:
|
if block:
|
||||||
_token, management_url, _tenant_id = block.split('|', 2)
|
_token, management_url, _tenant_id = block.split('|', 2)
|
||||||
except (KeyringIOError, ValueError):
|
except all_errors:
|
||||||
pass
|
pass
|
||||||
return management_url
|
return management_url
|
||||||
|
|
||||||
@ -174,7 +175,7 @@ class SecretsHelper(object):
|
|||||||
block = keyring.get_password('novaclient_auth', self._make_key())
|
block = keyring.get_password('novaclient_auth', self._make_key())
|
||||||
if block:
|
if block:
|
||||||
token, _management_url, _tenant_id = block.split('|', 2)
|
token, _management_url, _tenant_id = block.split('|', 2)
|
||||||
except (KeyringIOError, ValueError):
|
except all_errors:
|
||||||
pass
|
pass
|
||||||
return token
|
return token
|
||||||
|
|
||||||
@ -187,7 +188,7 @@ class SecretsHelper(object):
|
|||||||
block = keyring.get_password('novaclient_auth', self._make_key())
|
block = keyring.get_password('novaclient_auth', self._make_key())
|
||||||
if block:
|
if block:
|
||||||
_token, _management_url, tenant_id = block.split('|', 2)
|
_token, _management_url, tenant_id = block.split('|', 2)
|
||||||
except (KeyringIOError, ValueError):
|
except all_errors:
|
||||||
pass
|
pass
|
||||||
return tenant_id
|
return tenant_id
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user