[ARVADOS] updated: 55c34fb97edfba5a014eb43b965130cf11dbda8a
Git user
git at public.curoverse.com
Fri Mar 31 16:17:41 EDT 2017
Summary of changes:
sdk/python/arvados/api.py | 2 +-
sdk/python/tests/test_cache.py | 15 ++++++++++++++-
2 files changed, 15 insertions(+), 2 deletions(-)
via 55c34fb97edfba5a014eb43b965130cf11dbda8a (commit)
from 28e59edcec4af09f78be965fa3abfaa9ee3f8dff (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 55c34fb97edfba5a014eb43b965130cf11dbda8a
Author: Tom Clegg <tom at curoverse.com>
Date: Fri Mar 31 16:17:19 2017 -0400
11402: Disable caching if $HOME/ is not writable, instead of returning a broken cache.
closes #11402
diff --git a/sdk/python/arvados/api.py b/sdk/python/arvados/api.py
index d1263e2..1af50b3 100644
--- a/sdk/python/arvados/api.py
+++ b/sdk/python/arvados/api.py
@@ -136,7 +136,7 @@ def http_cache(data_type):
try:
util.mkdir_dash_p(path)
except OSError:
- path = None
+ return None
return cache.SafeHTTPCache(path, max_age=60*60*24*2)
def api(version=None, cache=True, host=None, token=None, insecure=False, **kwargs):
diff --git a/sdk/python/tests/test_cache.py b/sdk/python/tests/test_cache.py
index baa60bf..4d68b40 100644
--- a/sdk/python/tests/test_cache.py
+++ b/sdk/python/tests/test_cache.py
@@ -2,14 +2,16 @@ from __future__ import print_function
import md5
import mock
-import shutil
+import os
import random
+import shutil
import sys
import tempfile
import threading
import unittest
import arvados.cache
+import arvados
import run_test_server
@@ -47,6 +49,17 @@ class CacheTest(unittest.TestCase):
def tearDown(self):
shutil.rmtree(self._dir)
+ def test_cache_create_error(self):
+ _, filename = tempfile.mkstemp()
+ home_was = os.environ['HOME']
+ os.environ['HOME'] = filename
+ try:
+ c = arvados.http_cache('test')
+ self.assertEqual(None, c)
+ finally:
+ os.environ['HOME'] = home_was
+ os.unlink(filename)
+
def test_cache_crud(self):
c = arvados.cache.SafeHTTPCache(self._dir, max_age=0)
url = 'https://example.com/foo?bar=baz'
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list