2017-03-07 02:03:04 -05:00
|
|
|
package common
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2018-10-25 17:17:35 -04:00
|
|
|
"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"`
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|