Insert Packer's version into the User Agent. (#3465)
This commit is contained in:
parent
2bcd276528
commit
2d1347c1ec
|
@ -8,6 +8,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/mitchellh/packer/packer"
|
"github.com/mitchellh/packer/packer"
|
||||||
|
"github.com/mitchellh/packer/version"
|
||||||
|
|
||||||
"golang.org/x/oauth2"
|
"golang.org/x/oauth2"
|
||||||
"golang.org/x/oauth2/google"
|
"golang.org/x/oauth2/google"
|
||||||
|
@ -68,12 +69,7 @@ func NewDriverGCE(ui packer.Ui, p string, a *accountFile) (Driver, error) {
|
||||||
log.Printf("[INFO] Instantiating GCE client...")
|
log.Printf("[INFO] Instantiating GCE client...")
|
||||||
service, err := compute.New(client)
|
service, err := compute.New(client)
|
||||||
// Set UserAgent
|
// Set UserAgent
|
||||||
versionString := "0.0.0"
|
versionString := version.FormattedVersion()
|
||||||
// TODO(dcunnin): Use Packer's version code from version.go
|
|
||||||
// versionString := main.Version
|
|
||||||
// if main.VersionPrerelease != "" {
|
|
||||||
// versionString = fmt.Sprintf("%s-%s", versionString, main.VersionPrerelease)
|
|
||||||
// }
|
|
||||||
service.UserAgent = fmt.Sprintf(
|
service.UserAgent = fmt.Sprintf(
|
||||||
"(%s %s) Packer/%s", runtime.GOOS, runtime.GOARCH, versionString)
|
"(%s %s) Packer/%s", runtime.GOOS, runtime.GOARCH, versionString)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue