osclib/cache: provide mechanism to init multiple times.
Useful for staging plugin to cache the remote config before StagingAPI is initialized.
This commit is contained in:
parent
c47bb4c902
commit
3b8ae3174c
@ -389,6 +389,9 @@ def do_staging(self, subcmd, opts, *args):
|
||||
else:
|
||||
opts.project = 'Factory'
|
||||
|
||||
# Cache the remote config fetch.
|
||||
Cache.init()
|
||||
|
||||
# Init the OBS access and configuration
|
||||
opts.project = self._full_project_name(opts.project)
|
||||
opts.apiurl = self.get_api_url()
|
||||
|
@ -103,6 +103,11 @@ class Cache(object):
|
||||
|
||||
@staticmethod
|
||||
def init(directory='main'):
|
||||
if Cache.CACHE_DIR:
|
||||
# Stick with the first initialization to allow for StagingAPI to
|
||||
# ensure always enabled, but allow parent to change directory.
|
||||
return
|
||||
|
||||
Cache.CACHE_DIR = CacheManager.directory('request', directory)
|
||||
|
||||
Cache.patterns = []
|
||||
|
Loading…
x
Reference in New Issue
Block a user