From 95ef2a1eb21a96d026a4ca0aa5a6311d52b5cc27 Mon Sep 17 00:00:00 2001 From: Matheus Macabu Date: Thu, 5 Sep 2024 15:34:20 +0200 Subject: [PATCH] CloudMigrations: Fix snapshot creation on Windows systems (#92941) * cloudmigration: improve error logging stringify body * deps: update migration snapshot library to v1.3.0 (fix to Windows) --- go.mod | 2 +- go.sum | 4 ++-- pkg/services/cloudmigration/gmsclient/gms_client.go | 2 +- pkg/services/cloudmigration/objectstorage/s3.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 3571b3a20fe..00f9a905902 100644 --- a/go.mod +++ b/go.mod @@ -86,7 +86,7 @@ require ( github.com/grafana/gomemcache v0.0.0-20240805133030-fdaf6a95408e // @grafana/grafana-operator-experience-squad github.com/grafana/grafana-aws-sdk v0.30.0 // @grafana/aws-datasources github.com/grafana/grafana-azure-sdk-go/v2 v2.1.1 // @grafana/partner-datasources - github.com/grafana/grafana-cloud-migration-snapshot v1.2.0 // @grafana/grafana-operator-experience-squad + github.com/grafana/grafana-cloud-migration-snapshot v1.3.0 // @grafana/grafana-operator-experience-squad github.com/grafana/grafana-google-sdk-go v0.1.0 // @grafana/partner-datasources github.com/grafana/grafana-openapi-client-go v0.0.0-20231213163343-bd475d63fb79 // @grafana/grafana-backend-group github.com/grafana/grafana-plugin-sdk-go v0.246.0 // @grafana/plugins-platform-backend diff --git a/go.sum b/go.sum index f2e128c0ede..674372d13d3 100644 --- a/go.sum +++ b/go.sum @@ -2280,8 +2280,8 @@ github.com/grafana/grafana-aws-sdk v0.30.0 h1:6IIetM4s2NbvPOI4/fefsyN84BIb0/T09l github.com/grafana/grafana-aws-sdk v0.30.0/go.mod h1:ZSVPU7IIJSi5lEg+K3Js+EUpZLXxUaBdaQWH+As1ihI= github.com/grafana/grafana-azure-sdk-go/v2 v2.1.1 h1:90HjoS3kvCd6Thvcl29rtL2+AcSt9AAIDqgQAGk/6T8= github.com/grafana/grafana-azure-sdk-go/v2 v2.1.1/go.mod h1:yqaupYdH8i42m3VRrmVgNNLGvr4NVjoDmstgZzASAnc= -github.com/grafana/grafana-cloud-migration-snapshot v1.2.0 h1:FCUWASPPzGGbF2jTutR5i3rmoQdmnC4bypwJswdW3fI= -github.com/grafana/grafana-cloud-migration-snapshot v1.2.0/go.mod h1:bd6Cm06EK0MzRO5ahUpbDz1SxNOKu+fzladbaRPHZPY= +github.com/grafana/grafana-cloud-migration-snapshot v1.3.0 h1:F0O9eTy4jHjEd1Z3/qIza2GdY7PYpTddUeaq9p3NKGU= +github.com/grafana/grafana-cloud-migration-snapshot v1.3.0/go.mod h1:bd6Cm06EK0MzRO5ahUpbDz1SxNOKu+fzladbaRPHZPY= github.com/grafana/grafana-google-sdk-go v0.1.0 h1:LKGY8z2DSxKjYfr2flZsWgTRTZ6HGQbTqewE3JvRaNA= github.com/grafana/grafana-google-sdk-go v0.1.0/go.mod h1:Vo2TKWfDVmNTELBUM+3lkrZvFtBws0qSZdXhQxRdJrE= github.com/grafana/grafana-openapi-client-go v0.0.0-20231213163343-bd475d63fb79 h1:r+mU5bGMzcXCRVAuOrTn54S80qbfVkvTdUJZfSfTNbs= diff --git a/pkg/services/cloudmigration/gmsclient/gms_client.go b/pkg/services/cloudmigration/gmsclient/gms_client.go index a831d58aa00..d9804d4e157 100644 --- a/pkg/services/cloudmigration/gmsclient/gms_client.go +++ b/pkg/services/cloudmigration/gmsclient/gms_client.go @@ -65,7 +65,7 @@ func (c *gmsClientImpl) ValidateKey(ctx context.Context, cm cloudmigration.Cloud if resp.StatusCode != 200 { body, _ := io.ReadAll(resp.Body) - return fmt.Errorf("token validation failure: %v", body) + return fmt.Errorf("token validation failure: %v", string(body)) } return nil diff --git a/pkg/services/cloudmigration/objectstorage/s3.go b/pkg/services/cloudmigration/objectstorage/s3.go index dc84553cde1..32bfecfd4f5 100644 --- a/pkg/services/cloudmigration/objectstorage/s3.go +++ b/pkg/services/cloudmigration/objectstorage/s3.go @@ -86,7 +86,7 @@ func (s3 *S3) PresignedURLUpload(ctx context.Context, presignedURL, key string, if response.StatusCode >= 400 { body, _ := io.ReadAll(response.Body) - return fmt.Errorf("unexpected response: status=%d body=%s", response.StatusCode, body) + return fmt.Errorf("unexpected response: status=%d body=%s", response.StatusCode, string(body)) } return nil