workflow traces: do not crash on empty event_args (#73733)
gitea-wip/wcs/pipeline/pr-main This commit looks good Details

This commit is contained in:
Frédéric Péters 2023-01-23 15:21:35 +01:00
parent 92dac5eb8c
commit 4a184b56de
1 changed files with 4 additions and 0 deletions

View File

@ -97,6 +97,8 @@ class WorkflowTrace(sql.WorkflowTrace):
def get_base_url(self, workflow, status_id, global_event):
if global_event:
if not global_event.event_args:
raise KeyError()
return '%sglobal-actions/%s/' % (
workflow.get_admin_url(),
global_event.event_args.get('global_action_id'),
@ -106,6 +108,8 @@ class WorkflowTrace(sql.WorkflowTrace):
def get_real_action(self, workflow, status_id, action_id, global_event):
if global_event:
if not global_event.event_args:
return None
global_action_id = global_event.event_args.get('global_action_id')
try:
global_action = [x for x in workflow.global_actions if x.id == global_action_id][0]