fix set user-agent (#10361)
This commit is contained in:
parent
e0e82e2192
commit
f8e85f94fd
|
@ -12,7 +12,6 @@ import (
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/useragent"
|
"github.com/hashicorp/packer/packer-plugin-sdk/useragent"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/metadata"
|
|
||||||
|
|
||||||
"github.com/hashicorp/packer/builder/yandex/version"
|
"github.com/hashicorp/packer/builder/yandex/version"
|
||||||
"github.com/yandex-cloud/go-genproto/yandex/cloud/compute/v1"
|
"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.
|
// Now we will have new request id for every retry attempt.
|
||||||
interceptorChain := grpc_middleware.ChainUnaryClient(retryInterceptor, requestIDInterceptor)
|
interceptorChain := grpc_middleware.ChainUnaryClient(retryInterceptor, requestIDInterceptor)
|
||||||
|
|
||||||
userAgentMD := metadata.Pairs("user-agent", useragent.String(version.YandexPluginVersion.FormattedVersion()))
|
|
||||||
|
|
||||||
sdk, err := ycsdk.Build(context.Background(), sdkConfig,
|
sdk, err := ycsdk.Build(context.Background(), sdkConfig,
|
||||||
grpc.WithDefaultCallOptions(grpc.Header(&userAgentMD)),
|
grpc.WithUserAgent(useragent.String(version.YandexPluginVersion.FormattedVersion())),
|
||||||
grpc.WithUnaryInterceptor(interceptorChain))
|
grpc.WithUnaryInterceptor(interceptorChain),
|
||||||
|
)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in New Issue