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

26 lines
440 B
Go
Raw Normal View History

2013-12-22 13:40:39 -05:00
package common
import (
"errors"
"github.com/mitchellh/packer/template/interpolate"
2013-12-22 13:40:39 -05:00
)
type ExportConfig struct {
Format string `mapstruture:"format"`
}
func (c *ExportConfig) Prepare(ctx *interpolate.Context) []error {
2013-12-22 13:40:39 -05:00
if c.Format == "" {
c.Format = "ovf"
}
var errs []error
2013-12-22 13:40:39 -05:00
if c.Format != "ovf" && c.Format != "ova" {
errs = append(errs,
errors.New("invalid format, only 'ovf' or 'ova' are allowed"))
}
return errs
}