Skip to content

Commit b5c710b

Browse files
a-waiJenySadadia
authored andcommitted
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 ensuring this field is a dict before calling `update()`. Signed-off-by: Arnaud Ferraris <[email protected]>
1 parent e4aa2a0 commit b5c710b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernelci/api/helper.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,8 @@ 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+
if root_node.get('artifacts') is None:
563+
root_node['artifacts'] = {}
562564
root_node['artifacts'].update(results['node']['artifacts'])
563565
root_node['data'].update(results['node'].get('data', {}))
564566
root_node['processed_by_kcidb_bridge'] = False

0 commit comments

Comments
 (0)