github.com/sneal/packer@v0.5.2/builder/virtualbox/common/run_config.go (about) 1 package common 2 3 import ( 4 "fmt" 5 "github.com/mitchellh/packer/packer" 6 "time" 7 ) 8 9 type RunConfig struct { 10 Headless bool `mapstructure:"headless"` 11 RawBootWait string `mapstructure:"boot_wait"` 12 13 BootWait time.Duration `` 14 } 15 16 func (c *RunConfig) Prepare(t *packer.ConfigTemplate) []error { 17 if c.RawBootWait == "" { 18 c.RawBootWait = "10s" 19 } 20 21 templates := map[string]*string{ 22 "boot_wait": &c.RawBootWait, 23 } 24 25 errs := make([]error, 0) 26 for n, ptr := range templates { 27 var err error 28 *ptr, err = t.Process(*ptr, nil) 29 if err != nil { 30 errs = append(errs, fmt.Errorf("Error processing %s: %s", n, err)) 31 } 32 } 33 34 var err error 35 c.BootWait, err = time.ParseDuration(c.RawBootWait) 36 if err != nil { 37 errs = append(errs, fmt.Errorf("Failed parsing boot_wait: %s", err)) 38 } 39 40 return errs 41 }