Commit 11684b6f authored by Phyks's avatar Phyks

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

parent 15fcb043
Pipeline #104593 failed with stage
in 5 minutes and 12 seconds
......@@ -521,14 +521,19 @@ def metadata_v1(config):
return {}
try:
ts_file = os.path.join(
config['data_directory'],
'timestamp'
)
ts = os.path.getmtime(ts_file)
last_update = None
try:
ts_file = os.path.join(
config['data_directory'],
'timestamp'
)
last_update = os.path.getmtime(ts_file)
except OSError:
pass
return {
'data': {
'last_update': ts
'last_update': last_update
}
}
except Exception as exc: # pylint: disable= broad-except
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment