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

30 lines
531 B
Go
Raw Normal View History

package common
import (
"fmt"
"time"
"github.com/mitchellh/packer/template/interpolate"
)
type RunConfig struct {
Headless bool `mapstructure:"headless"`
RawBootWait string `mapstructure:"boot_wait"`
BootWait time.Duration ``
}
func (c *RunConfig) Prepare(ctx *interpolate.Context) []error {
if c.RawBootWait == "" {
c.RawBootWait = "10s"
}
var err error
c.BootWait, err = time.ParseDuration(c.RawBootWait)
if err != nil {
return []error{fmt.Errorf("Failed parsing boot_wait: %s", err)}
}
return nil
}