From 8ffb2ddc268d1f20b16232c6e9c24966526e700d Mon Sep 17 00:00:00 2001 From: Olivier FAURAX Date: Thu, 9 Nov 2023 11:30:00 +0100 Subject: [PATCH] Add traces --- providers/asrockrack/helpers.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/providers/asrockrack/helpers.go b/providers/asrockrack/helpers.go index be4eb60a..7b01ed7d 100644 --- a/providers/asrockrack/helpers.go +++ b/providers/asrockrack/helpers.go @@ -233,10 +233,13 @@ 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 { @@ -244,6 +247,7 @@ func (a *ASRockRack) uploadFirmware(ctx context.Context, endpoint string, fwRead return } + a.log.V(2).Info("Copy from reader") // copy from source into form part writer _, err = io.Copy(part, fwReader) if err != nil { @@ -251,8 +255,10 @@ func (a *ASRockRack) uploadFirmware(ctx context.Context, endpoint string, fwRead 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 @@ -260,7 +266,8 @@ func (a *ASRockRack) uploadFirmware(ctx context.Context, endpoint string, fwRead "Content-Type": form.FormDataContentType(), } - <-errCh + a.log.V(2).Info("After headers") + //<-errCh //mybytes, err := io.ReadAll(pipeReader) //if len(mybytes) < 1000 {