packer-cn/builder/hyperv/common/run_config.go

34 lines
548 B
Go
Raw Normal View History

package common
import (
"fmt"
"time"
2018-01-22 20:21:10 -05:00
"github.com/hashicorp/packer/template/interpolate"
)
type RunConfig struct {
RawBootWait string `mapstructure:"boot_wait"`
BootWait time.Duration ``
}
func (c *RunConfig) Prepare(ctx *interpolate.Context) []error {
if c.RawBootWait == "" {
c.RawBootWait = "10s"
}
var errs []error
var err error
if c.RawBootWait != "" {
c.BootWait, err = time.ParseDuration(c.RawBootWait)
if err != nil {
errs = append(
errs, fmt.Errorf("Failed parsing boot_wait: %s", err))
}
}
return errs
}