keyring: Fix default keyring usage

This commit is contained in:
Cole Robinson 2010-06-15 10:33:45 -04:00
parent e1b73b6bd3
commit e8c8c06c32
2 changed files with 8 additions and 3 deletions

View File

@ -65,6 +65,7 @@ Further patches have been submitted by:
Ales Zelinka <azelinka-at-redhat.com>
Jan ONDREJ <ondrejj-at-salstar-dot-sk>
Marc Deslauriers <marc.deslauriers-at-ubuntu-dot-com>
Matthias Fulz <olz1983-at-googlemail-dot-com>
<...send a patch & get your name here...>

View File

@ -37,11 +37,15 @@ class vmmKeyring:
return
try:
if not("default" in gnomekeyring.list_keyring_names_sync()):
gnomekeyring.create_sync("default", None)
self.keyring = gnomekeyring.get_default_keyring_sync()
if self.keyring == None:
logging.warning("Failed to create default keyring")
# Code borrowed from
# http://trac.gajim.org/browser/src/common/passwords.py
self.keyring = 'default'
try:
gnomekeyring.create_sync(self.keyring, None)
except gnomekeyring.AlreadyExistsError:
pass
except:
logging.exception("Error determining keyring")
self.keyring = None