Remove dependency from cache to config

Getting the right config depends on too many things that cache.py can't
know - so just rely on environment variables instead

Fixes #2289
This commit is contained in:
Stephan Kulow 2019-11-05 11:26:59 +01:00
parent a595666eef
commit 31ee1047cd
2 changed files with 4 additions and 9 deletions

View File

@ -112,9 +112,8 @@ class Cache(object):
Cache.patterns = [] Cache.patterns = []
conf.get_config() if str2bool(os.environ.get('OSRT_DISABLE_CACHE', '')):
if str2bool(conf.config.get('osrt.cache.disable', '')): if conf.config['debug']: print('CACHE_DISABLE via $OSRT_DISABLE_CACHE', file=sys.stderr)
if conf.config['debug']: print('CACHE_DISABLE via osrt.cache.disable', file=sys.stderr)
return return
for pattern in Cache.PATTERNS: for pattern in Cache.PATTERNS:

View File

@ -26,11 +26,7 @@ from osclib.core import attribute_value_save
from osclib.core import request_state_change from osclib.core import request_state_change
from osclib.memoize import memoize_session_reset from osclib.memoize import memoize_session_reset
try: from urllib.error import HTTPError, URLError
from urllib.error import HTTPError, URLError
except ImportError:
#python 2.x
from urllib2 import HTTPError, URLError
# pointing to other docker container # pointing to other docker container
APIURL = 'http://api:3000' APIURL = 'http://api:3000'
@ -71,7 +67,6 @@ class TestCase(unittest.TestCase):
'[general]', '[general]',
'apiurl = http://api:3000', 'apiurl = http://api:3000',
'cookiejar = {}'.format(OSCCOOKIEJAR), 'cookiejar = {}'.format(OSCCOOKIEJAR),
'osrt.cache.disable = true',
'[http://api:3000]', '[http://api:3000]',
'user = {}'.format(userid), 'user = {}'.format(userid),
'pass = opensuse', 'pass = opensuse',
@ -104,6 +99,7 @@ class TestCase(unittest.TestCase):
override_no_keyring=True, override_no_keyring=True,
override_no_gnome_keyring=True) override_no_gnome_keyring=True)
os.environ['OSC_CONFIG'] = OSCRC os.environ['OSC_CONFIG'] = OSCRC
os.environ['OSRT_DISABLE_CACHE'] = 'true'
def execute_script(self, args): def execute_script(self, args):
if self.script: if self.script: