github.com/kaixiang/packer@v0.5.2-0.20140114230416-1f5786b0d7f1/builder/virtualbox/common/vbox_version_config.go (about) 1 package common 2 3 import ( 4 "fmt" 5 "github.com/mitchellh/packer/packer" 6 ) 7 8 type VBoxVersionConfig struct { 9 VBoxVersionFile string `mapstructure:"virtualbox_version_file"` 10 } 11 12 func (c *VBoxVersionConfig) Prepare(t *packer.ConfigTemplate) []error { 13 if c.VBoxVersionFile == "" { 14 c.VBoxVersionFile = ".vbox_version" 15 } 16 17 templates := map[string]*string{ 18 "virtualbox_version_file": &c.VBoxVersionFile, 19 } 20 21 errs := make([]error, 0) 22 for n, ptr := range templates { 23 var err error 24 *ptr, err = t.Process(*ptr, nil) 25 if err != nil { 26 errs = append(errs, fmt.Errorf("Error processing %s: %s", n, err)) 27 } 28 } 29 30 return errs 31 }