提交 d37cb91d 编写于 作者: C Cleber Rosa

Asset Fetcher: make the cache dirs visible

The asset fetchers cache directories are system wide, and not test
specific.  They're available at the test only for convenience.

They relate much more to the the other data directories, and deserve
to be visible by users alongside the other data directories.
Signed-off-by: NCleber Rosa <crosa@redhat.com>
上级 a309a724
...@@ -199,6 +199,18 @@ def create_job_logs_dir(base_dir=None, unique_id=None): ...@@ -199,6 +199,18 @@ def create_job_logs_dir(base_dir=None, unique_id=None):
% (logdir)) % (logdir))
def get_cache_dirs():
"""
Returns the list of cache dirs, according to configuration and convention
"""
cache_dirs = settings.settings.get_value('datadir.paths', 'cache_dirs',
key_type=list, default=[])
datadir_cache = os.path.join(get_data_dir(), 'cache')
if datadir_cache not in cache_dirs:
cache_dirs.append(datadir_cache)
return cache_dirs
class _TmpDirTracker(Borg): class _TmpDirTracker(Borg):
def __init__(self): def __init__(self):
......
...@@ -567,12 +567,7 @@ class Test(unittest.TestCase, TestData): ...@@ -567,12 +567,7 @@ class Test(unittest.TestCase, TestData):
Returns a list of cache directories as set in config file. Returns a list of cache directories as set in config file.
""" """
if self.__cache_dirs is None: if self.__cache_dirs is None:
cache_dirs = settings.get_value('datadir.paths', 'cache_dirs', self.__cache_dirs = data_dir.get_cache_dirs()
key_type=list, default=[])
datadir_cache = os.path.join(data_dir.get_data_dir(), 'cache')
if datadir_cache not in cache_dirs:
cache_dirs.append(datadir_cache)
self.__cache_dirs = cache_dirs
return self.__cache_dirs return self.__cache_dirs
@property @property
......
...@@ -70,3 +70,4 @@ class Config(CLICmd): ...@@ -70,3 +70,4 @@ class Config(CLICmd):
LOG_UI.debug(' tests ' + data_dir.get_test_dir()) LOG_UI.debug(' tests ' + data_dir.get_test_dir())
LOG_UI.debug(' data ' + data_dir.get_data_dir()) LOG_UI.debug(' data ' + data_dir.get_data_dir())
LOG_UI.debug(' logs ' + data_dir.get_logs_dir()) LOG_UI.debug(' logs ' + data_dir.get_logs_dir())
LOG_UI.debug(' cache ' + ", ".join(data_dir.get_cache_dirs()))
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册