Don't crash metadata API route if timestamp file is not ready

This commit is contained in:
Lucas Verney 2019-01-17 09:16:04 +01:00
parent 15fcb04368
commit 11684b6fd7
1 changed files with 11 additions and 6 deletions

View File

@ -521,14 +521,19 @@ def metadata_v1(config):
return {} return {}
try: try:
ts_file = os.path.join( last_update = None
config['data_directory'], try:
'timestamp' ts_file = os.path.join(
) config['data_directory'],
ts = os.path.getmtime(ts_file) 'timestamp'
)
last_update = os.path.getmtime(ts_file)
except OSError:
pass
return { return {
'data': { 'data': {
'last_update': ts 'last_update': last_update
} }
} }
except Exception as exc: # pylint: disable= broad-except except Exception as exc: # pylint: disable= broad-except