Skip to content

Commit

Permalink
Use a better solution
Browse files Browse the repository at this point in the history
  • Loading branch information
swills committed Jan 3, 2022
1 parent 6b9e1ba commit 14d1368
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions grpc-server/tinkerbell.go
Expand Up @@ -55,20 +55,17 @@ func (s *server) GetWorkflowContextList(ctx context.Context, req *pb.WorkflowCon
return nil, err
}

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

// GetWorkflowActions implements tinkerbell.GetWorkflowActions.
Expand Down

0 comments on commit 14d1368

Please sign in to comment.