Skip to content

Commit

Permalink
Add traces
Browse files Browse the repository at this point in the history
  • Loading branch information
ofaurax committed Nov 9, 2023
1 parent 9feee99 commit 8ffb2dd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion providers/asrockrack/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,34 +233,41 @@ func (a *ASRockRack) uploadFirmware(ctx context.Context, endpoint string, fwRead
// initiate a mulitpart writer
form := multipart.NewWriter(pipeWriter)

a.log.V(2).Info("Launching go routine")

errCh := make(chan error, 1)
go func() {
defer pipeWriter.Close()

a.log.V(2).Info("CreateFormFile")
// create form part
part, err := form.CreateFormFile(fieldName, fileName)
if err != nil {
errCh <- err
return
}

a.log.V(2).Info("Copy from reader")
// copy from source into form part writer
_, err = io.Copy(part, fwReader)
if err != nil {
errCh <- err
return
}

a.log.V(2).Info("Before Close")
// add terminating boundary to multipart form
errCh <- form.Close()
a.log.V(2).Info("After Close")
}()

// multi-part content type
headers := map[string]string{
"Content-Type": form.FormDataContentType(),
}

<-errCh
a.log.V(2).Info("After headers")
//<-errCh

//mybytes, err := io.ReadAll(pipeReader)
//if len(mybytes) < 1000 {
Expand Down

0 comments on commit 8ffb2dd

Please sign in to comment.