From f8e85f94fdd0ed19edc785658bf8ff221851be51 Mon Sep 17 00:00:00 2001 From: Roman Mingazeev Date: Wed, 9 Dec 2020 16:48:35 +0300 Subject: [PATCH] fix set user-agent (#10361) --- builder/yandex/driver_yc.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/builder/yandex/driver_yc.go b/builder/yandex/driver_yc.go index df4c9f46f..8bcb44b4d 100644 --- a/builder/yandex/driver_yc.go +++ b/builder/yandex/driver_yc.go @@ -12,7 +12,6 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/useragent" "google.golang.org/grpc" "google.golang.org/grpc/codes" - "google.golang.org/grpc/metadata" "github.com/hashicorp/packer/builder/yandex/version" "github.com/yandex-cloud/go-genproto/yandex/cloud/compute/v1" @@ -84,11 +83,10 @@ func NewDriverYC(ui packersdk.Ui, ac *AccessConfig) (Driver, error) { // Now we will have new request id for every retry attempt. interceptorChain := grpc_middleware.ChainUnaryClient(retryInterceptor, requestIDInterceptor) - userAgentMD := metadata.Pairs("user-agent", useragent.String(version.YandexPluginVersion.FormattedVersion())) - sdk, err := ycsdk.Build(context.Background(), sdkConfig, - grpc.WithDefaultCallOptions(grpc.Header(&userAgentMD)), - grpc.WithUnaryInterceptor(interceptorChain)) + grpc.WithUserAgent(useragent.String(version.YandexPluginVersion.FormattedVersion())), + grpc.WithUnaryInterceptor(interceptorChain), + ) if err != nil { return nil, err