Merge pull request #389 from thobrla/master

Fall back to read-only credentials on EACCES errors.
This commit is contained in:
Nathaniel Manista
2016-01-29 08:45:44 -08:00
2 changed files with 4 additions and 1 deletions

View File

@@ -293,6 +293,8 @@ class _MultiStore(object):
elif e.errno == errno.EDEADLK:
logger.warn('Lock contention on multistore file, opening '
'in read-only mode.')
elif e.errno == errno.EACCES:
logger.warn('Cannot access credentials file.')
else:
raise
if not self._file.is_locked():

View File

@@ -82,7 +82,8 @@ class MultistoreFileTests(unittest.TestCase):
os.close(filehandle)
try:
for error_code in (errno.EDEADLK, errno.ENOSYS, errno.ENOLCK):
for error_code in (errno.EDEADLK, errno.ENOSYS, errno.ENOLCK,
errno.EACCES):
multistore = multistore_file._MultiStore(filename)
multistore._file = _MockLockedFile(filename, error_code)
# Should not raise even though the underlying file class did.