StepDownload uses packer version as user agent
This commit is contained in:
parent
9e5c0f6c6a
commit
4548495116
|
@ -70,6 +70,7 @@ func (s *StepDownload) Run(state multistep.StateBag) multistep.StepAction {
|
|||
CopyFile: false,
|
||||
Hash: HashForType(s.ChecksumType),
|
||||
Checksum: checksum,
|
||||
UserAgent: packer.VersionString(),
|
||||
}
|
||||
|
||||
path, err, retry := s.download(config, state)
|
||||
|
|
|
@ -31,6 +31,15 @@ func (versionCommand) Run(env Environment, args []string) int {
|
|||
env.Ui().Machine("version-prelease", VersionPrerelease)
|
||||
env.Ui().Machine("version-commit", GitCommit)
|
||||
|
||||
env.Ui().Say(VersionString())
|
||||
return 0
|
||||
}
|
||||
|
||||
func (versionCommand) Synopsis() string {
|
||||
return "print Packer version"
|
||||
}
|
||||
|
||||
func VersionString() string {
|
||||
var versionString bytes.Buffer
|
||||
fmt.Fprintf(&versionString, "Packer v%s", Version)
|
||||
if VersionPrerelease != "" {
|
||||
|
@ -41,10 +50,5 @@ func (versionCommand) Run(env Environment, args []string) int {
|
|||
}
|
||||
}
|
||||
|
||||
env.Ui().Say(versionString.String())
|
||||
return 0
|
||||
}
|
||||
|
||||
func (versionCommand) Synopsis() string {
|
||||
return "print Packer version"
|
||||
return versionString.String()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue