Skip to content
Snippets Groups Projects
Commit 72400d3f authored by Erik Reid's avatar Erik Reid
Browse files

only save log cache if tasks events are actually found

parent 0806f299
No related branches found
No related tags found
No related merge requests found
......@@ -94,8 +94,12 @@ def load_task_log():
'failed': []
}
found_tasks = False
for task in monitor.load_task_log(
current_app.config['INVENTORY_PROVIDER_CONFIG']).values():
found_tasks = True
for event in task.get('task-warning', []):
result['warnings'].append(event['message'])
for event in task.get('task-error', []):
......@@ -124,7 +128,7 @@ def load_task_log():
description = task['task-started'][0]['uuid']
result['pending'].append(description)
if not result['pending']:
if found_tasks and not result['pending']:
r.set(cache_key, json.dumps(result))
return jsonify(result)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment