github.com/rahart/packer@v0.12.2-0.20161229105310-282bb6ad370f/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  // RunConfig contains the configuration for VM run.
    11  type RunConfig struct {
    12  	RawBootWait string `mapstructure:"boot_wait"`
    13  
    14  	BootWait time.Duration ``
    15  }
    16  
    17  // Prepare sets the configuration for VM run.
    18  func (c *RunConfig) Prepare(ctx *interpolate.Context) []error {
    19  	if c.RawBootWait == "" {
    20  		c.RawBootWait = "10s"
    21  	}
    22  
    23  	var err error
    24  	c.BootWait, err = time.ParseDuration(c.RawBootWait)
    25  	if err != nil {
    26  		return []error{fmt.Errorf("Failed parsing boot_wait: %s", err)}
    27  	}
    28  
    29  	return nil
    30  }