github.com/homburg/packer@v0.6.1-0.20140528012651-1dcaf1716848/builder/parallels/common/prlctl_version_config.go (about) 1 package common 2 3 import ( 4 "fmt" 5 "github.com/mitchellh/packer/packer" 6 ) 7 8 type PrlctlVersionConfig struct { 9 PrlctlVersionFile string `mapstructure:"prlctl_version_file"` 10 } 11 12 func (c *PrlctlVersionConfig) Prepare(t *packer.ConfigTemplate) []error { 13 if c.PrlctlVersionFile == "" { 14 c.PrlctlVersionFile = ".prlctl_version" 15 } 16 17 templates := map[string]*string{ 18 "prlctl_version_file": &c.PrlctlVersionFile, 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 }