Gracefully handle failure to cache UUID's. Bug #897885.
Change-Id: I2ef58a218277b2a62c0e24c907250421dccffe9a
This commit is contained in:
parent
674c63e99d
commit
2f49282bd0
1
AUTHORS
1
AUTHORS
@ -23,6 +23,7 @@ Jesse Andrews <anotherjesse@gmail.com>
|
||||
Johannes Erdfelt <johannes.erdfelt@rackspace.com>
|
||||
Josh Kearney <josh@jk0.org>
|
||||
Kevin L. Mitchell <kevin.mitchell@rackspace.com>
|
||||
Kiall Mac Innes <kiall@managedit.ie>
|
||||
Kirill Shileev <kshileev@griddynamics.com>
|
||||
Lvov Maxim <mlvov@mirantis.com>
|
||||
Matt Dietz <matt.dietz@rackspace.com>
|
||||
|
@ -99,12 +99,20 @@ class Manager(object):
|
||||
resource = obj_class.__name__.lower()
|
||||
filename = os.path.expanduser("~/.novaclient_cached_%s_uuids" %
|
||||
resource)
|
||||
self._uuid_cache = open(filename, mode)
|
||||
|
||||
try:
|
||||
self._uuid_cache = open(filename, mode)
|
||||
except IOError:
|
||||
# NOTE(kiall): This is typicaly a permission denied while
|
||||
# attempting to write the cache file.
|
||||
pass
|
||||
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
self._uuid_cache.close()
|
||||
del self._uuid_cache
|
||||
if hasattr(self, '_uuid_cache'):
|
||||
self._uuid_cache.close()
|
||||
del self._uuid_cache
|
||||
|
||||
def write_uuid_to_cache(self, uuid):
|
||||
if hasattr(self, '_uuid_cache'):
|
||||
|
Loading…
x
Reference in New Issue
Block a user