Skip to content

Commit ed711e2

Browse files
committed
kernelci: api: helper: don't crash when adding artifacts to node
Nodes are created with `'artifacts': null`, meaning calling `update()` could lead to an uncaught exception, and therefore a crash. Avoid this situation by calling `update()` only when this key exists and yields a non-None value. Signed-off-by: Arnaud Ferraris <[email protected]>
1 parent 9df5d25 commit ed711e2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

kernelci/api/helper.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,10 @@ def submit_results(self, results, root):
559559
root_node = root.copy()
560560
root_node['result'] = results['node']['result']
561561
root_node['state'] = results['node'].get('state', 'done')
562-
root_node['artifacts'].update(results['node']['artifacts'])
562+
if root_node.get('artifacts'):
563+
root_node['artifacts'].update(results['node']['artifacts'])
564+
else:
565+
root_node['artifacts'] = results['node']['artifacts']
563566
root_node['data'].update(results['node'].get('data', {}))
564567
root_node['processed_by_kcidb_bridge'] = False
565568
if 'holdoff' in results['node']:

0 commit comments

Comments
 (0)