Skip to content

Commit

Permalink
fix: return nil, if no workflows are found for worker
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Gahlot <[email protected]>
  • Loading branch information
gauravgahlot committed Aug 13, 2020
1 parent 8ab2e15 commit 330491a
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions grpc-server/tinkerbell.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,21 @@ func (s *server) GetWorkflowContextList(context context.Context, req *pb.Workflo
if err != nil {
return nil, err
}
wfContexts := []*pb.WorkflowContext{}
for _, wf := range wfs {
wfContext, err := s.db.GetWorkflowContexts(context, wf)
if err != nil {
return nil, status.Errorf(codes.Aborted, err.Error())

if wfs != nil {
wfContexts := []*pb.WorkflowContext{}
for _, wf := range wfs {
wfContext, err := s.db.GetWorkflowContexts(context, wf)
if err != nil {
return nil, status.Errorf(codes.Aborted, err.Error())
}
wfContexts = append(wfContexts, wfContext)
}
wfContexts = append(wfContexts, wfContext)
return &pb.WorkflowContextList{
WorkflowContexts: wfContexts,
}, nil
}
return &pb.WorkflowContextList{
WorkflowContexts: wfContexts,
}, nil
return nil, nil
}

// GetWorkflowActions implements tinkerbell.GetWorkflowActions
Expand Down

0 comments on commit 330491a

Please sign in to comment.