Mentions légales du service

Skip to content
Snippets Groups Projects
Commit eb927545 authored by IMBERT Matthieu's avatar IMBERT Matthieu
Browse files

[execo_g5k] api_utils: fix always retrieving the full api cache due to...

[execo_g5k] api_utils: fix always retrieving the full api cache due to mismatched git commits at different levels
parent d01b9526
No related branches found
No related tags found
No related merge requests found
Pipeline #658477 passed
...@@ -290,7 +290,7 @@ def _is_cache_old_and_reachable(cache_dir): ...@@ -290,7 +290,7 @@ def _is_cache_old_and_reachable(cache_dir):
except: except:
logger.warning('Unable to check API, reverting to cache') logger.warning('Unable to check API, reverting to cache')
return False return False
if local_commit != get_resource_attributes('')['version']: if local_commit != api_commit:
logger.info('Cache is outdated, will retrieve the latest commit') logger.info('Cache is outdated, will retrieve the latest commit')
return True return True
else: else:
...@@ -365,7 +365,8 @@ def _get_api(): ...@@ -365,7 +365,8 @@ def _get_api():
for t in [ backbone_th ] + list(site_th.values()): for t in [ backbone_th ] + list(site_th.values()):
t.join() t.join()
data = {'network': {}, data = {'version': get_resource_attributes('')['version'],
'network': {},
'sites': {}, 'sites': {},
'clusters': {}, 'clusters': {},
'hosts': {}, 'hosts': {},
...@@ -397,7 +398,7 @@ def _write_api_cache(cache_dir, data): ...@@ -397,7 +398,7 @@ def _write_api_cache(cache_dir, data):
with open(cache_dir + e, 'wb') as f: with open(cache_dir + e, 'wb') as f:
dump(d, f) dump(d, f)
with open(cache_dir + 'api_commit', 'w') as f: with open(cache_dir + 'api_commit', 'w') as f:
f.write(data['network']['backbone'][0]['version']) f.write(data['version'])
def _read_api_cache(cache_dir): def _read_api_cache(cache_dir):
"""Read the picke files from cache_dir and return two dicts """Read the picke files from cache_dir and return two dicts
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment