Set default VM name to packer-BUILDNAME-TIMESTAMP

This commit is contained in:
Cheng Sun 2014-12-31 17:26:27 +00:00
parent cd1875019d
commit 201a9be4a8

View File

@ -112,6 +112,10 @@ func (c *CommonConfig) Prepare(t *packer.ConfigTemplate, pc *common.PackerConfig
c.OutputDir = fmt.Sprintf("output-%s", pc.PackerBuildName)
}
if c.VMName == "" {
c.VMName = fmt.Sprintf("packer-%s-{{timestamp}}", pc.PackerBuildName)
}
if c.Format == "" {
c.Format = "xva"
}
@ -167,10 +171,6 @@ func (c *CommonConfig) Prepare(t *packer.ConfigTemplate, pc *common.PackerConfig
errs = append(errs, errors.New("remote_host must be specified."))
}
if c.VMName == "" {
errs = append(errs, errors.New("vm_name must be specified."))
}
if c.HostPortMin > c.HostPortMax {
errs = append(errs, errors.New("the host min port must be less than the max"))
}