packer-cn/builder/vmware/common/tools_config.go

30 lines
1.0 KiB
Go
Raw Normal View History

//go:generate struct-markdown
package common
import (
2017-04-04 16:39:01 -04:00
"github.com/hashicorp/packer/template/interpolate"
)
type ToolsConfig struct {
// The flavor of the VMware Tools ISO to
2019-06-06 10:29:25 -04:00
// upload into the VM. Valid values are darwin, linux, and windows. By
// default, this is empty, which means VMware tools won't be uploaded.
ToolsUploadFlavor string `mapstructure:"tools_upload_flavor" required:"false"`
2019-06-20 08:59:30 -04:00
// The path in the VM to upload the VMware tools. This only takes effect if
// `tools_upload_flavor` is non-empty. This is a [configuration
// template](/docs/templates/engine) that has a single valid variable:
2019-06-20 08:59:30 -04:00
// `Flavor`, which will be the value of `tools_upload_flavor`. By default
// the upload path is set to `{{.Flavor}}.iso`. This setting is not used
// when `remote_type` is `esx5`.
2019-06-06 10:29:25 -04:00
ToolsUploadPath string `mapstructure:"tools_upload_path" required:"false"`
}
2015-05-27 17:16:28 -04:00
func (c *ToolsConfig) Prepare(ctx *interpolate.Context) []error {
if c.ToolsUploadPath == "" {
c.ToolsUploadPath = "{{ .Flavor }}.iso"
}
2015-05-27 17:16:28 -04:00
return nil
}