github.com/mmcquillan/packer@v1.1.1-0.20171009221028-c85cf0483a5d/builder/hyperv/common/run_config.go (about)

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