mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 10:55:42 +03:00
add nil check around task resources in device hook
Looking at NewTaskRunner I'm unsure whether TaskRunner.TaskResources (from which req.TaskResources is set) is intended to be nil at times or if the TODO in NewTaskRunner is intended to ensure it is always non-nil.
This commit is contained in:
@@ -30,7 +30,9 @@ func (*deviceHook) Name() string {
|
||||
}
|
||||
|
||||
func (h *deviceHook) Prestart(ctx context.Context, req *interfaces.TaskPrestartRequest, resp *interfaces.TaskPrestartResponse) error {
|
||||
if len(req.TaskResources.Devices) == 0 {
|
||||
//TODO Can the nil check be removed once the TODO in NewTaskRunner
|
||||
// where this is set is addressed?
|
||||
if req.TaskResources == nil || len(req.TaskResources.Devices) == 0 {
|
||||
resp.Done = true
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user