github.com/emate/packer@v0.8.1-0.20150625195101-fe0fde195dc6/builder/parallels/common/run_config.go (about)

     1  package common
     2  
     3  import (
     4  	"fmt"
     5  	"time"
     6  
     7  	"github.com/mitchellh/packer/template/interpolate"
     8  )
     9  
    10  type RunConfig struct {
    11  	Headless    bool   `mapstructure:"headless"`
    12  	RawBootWait string `mapstructure:"boot_wait"`
    13  
    14  	BootWait time.Duration ``
    15  }
    16  
    17  func (c *RunConfig) Prepare(ctx *interpolate.Context) []error {
    18  	if c.RawBootWait == "" {
    19  		c.RawBootWait = "10s"
    20  	}
    21  
    22  	var err error
    23  	c.BootWait, err = time.ParseDuration(c.RawBootWait)
    24  	if err != nil {
    25  		return []error{fmt.Errorf("Failed parsing boot_wait: %s", err)}
    26  	}
    27  
    28  	return nil
    29  }