github.com/mitchellh/packer@v1.3.2/builder/virtualbox/common/export_config.go (about)

     1  package common
     2  
     3  import (
     4  	"errors"
     5  
     6  	"github.com/hashicorp/packer/template/interpolate"
     7  )
     8  
     9  type ExportConfig struct {
    10  	Format string `mapstructure:"format"`
    11  }
    12  
    13  func (c *ExportConfig) Prepare(ctx *interpolate.Context) []error {
    14  	if c.Format == "" {
    15  		c.Format = "ovf"
    16  	}
    17  
    18  	var errs []error
    19  	if c.Format != "ovf" && c.Format != "ova" {
    20  		errs = append(errs,
    21  			errors.New("invalid format, only 'ovf' or 'ova' are allowed"))
    22  	}
    23  
    24  	return errs
    25  }