Skip to content

Commit

Permalink
[core] protect from accessing nil t.Task
Browse files Browse the repository at this point in the history
  • Loading branch information
knopers8 committed Dec 13, 2024
1 parent 7195c29 commit c0c2f83
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/workflow/taskrole.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,14 +257,18 @@ func (t *taskRole) updateState(s sm.State) {
EnvironmentId: t.GetEnvironmentId().String(),
})
if t.state.get() == sm.ERROR {
host := ""
if t.Task != nil {
host = t.Task.GetHostname()
}
if t.Critical {
log.WithField("partition", t.GetEnvironmentId().String()).
WithField("level", infologger.IL_Ops).
Errorf("critical task '%s' on host '%s' went into ERROR, the environment will stop or tear down", t.Name, t.Task.GetHostname())
Errorf("critical task '%s' on host '%s' went into ERROR, the environment will stop or tear down", t.Name, host)
} else {
log.WithField("partition", t.GetEnvironmentId().String()).
WithField("level", infologger.IL_Ops).
Errorf("non-critical task '%s' on host '%s' went into ERROR, but the environment might continue", t.Name, t.Task.GetHostname())
Errorf("non-critical task '%s' on host '%s' went into ERROR, but the environment might continue", t.Name, host)
}

}
Expand Down

0 comments on commit c0c2f83

Please sign in to comment.