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

27 lines
675 B
Go
Raw Normal View History

2017-03-07 02:03:04 -05:00
package common
import (
"fmt"
"github.com/hashicorp/packer/template/interpolate"
2017-03-07 02:03:04 -05:00
)
type ExportConfig struct {
Format string `mapstructure:"format"`
OVFToolOptions []string `mapstructure:"ovftool_options"`
SkipExport bool `mapstructure:"skip_export"`
KeepRegistered bool `mapstructure:"keep_registered"`
SkipCompaction bool `mapstructure:"skip_compaction"`
2017-03-07 02:03:04 -05:00
}
func (c *ExportConfig) Prepare(ctx *interpolate.Context) []error {
var errs []error
if c.Format != "" {
if !(c.Format == "ova" || c.Format == "ovf" || c.Format == "vmx") {
errs = append(
errs, fmt.Errorf("format must be one of ova, ovf, or vmx"))
}
}
return errs
}