add packer user agent to HCP client (#11455)

pull/11458/head
Sylvia Moss 4 years ago committed by GitHub
parent 63eaf1f99b
commit ef41e7506e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -9,6 +9,7 @@ import (
rmmodels "github.com/hashicorp/hcp-sdk-go/clients/cloud-resource-manager/preview/2019-12-10/models"
"github.com/hashicorp/hcp-sdk-go/httpclient"
"github.com/hashicorp/packer/internal/registry/env"
"github.com/hashicorp/packer/version"
)
// Client is an HCP client capable of making requests on behalf of a service principal
@ -35,7 +36,9 @@ func NewClient() (*Client, error) {
}
}
cl, err := httpclient.New(httpclient.Config{})
cl, err := httpclient.New(httpclient.Config{
SourceChannel: fmt.Sprintf("packer/%s", version.PackerVersion.FormattedVersion()),
})
if err != nil {
return nil, &ClientError{
StatusCode: InvalidClientConfig,

Loading…
Cancel
Save