Revert "Only validate vmware resources on local hosts"
This reverts commit f01578c91e
.
This commit is contained in:
parent
7ad2104c7f
commit
6504f4f777
|
@ -13,19 +13,16 @@ type VMXConfig struct {
|
|||
VMXDataPost map[string]string `mapstructure:"vmx_data_post"`
|
||||
}
|
||||
|
||||
func (c *VMXConfig) Prepare(ctx *interpolate.Context, remoteType string) []error {
|
||||
func (c *VMXConfig) Prepare(ctx *interpolate.Context) []error {
|
||||
var errs []error
|
||||
var err error
|
||||
var desiredMem uint64
|
||||
|
||||
// Validate memory resources, only on local hosts
|
||||
if remoteType == "" {
|
||||
for k, v := range c.VMXData {
|
||||
if k == "memsize" {
|
||||
desiredMem, err = strconv.ParseUint(v, 10, 64)
|
||||
if err != nil {
|
||||
errs = append(errs, fmt.Errorf("Error parsing string: %s", err))
|
||||
}
|
||||
for k, v := range c.VMXData {
|
||||
if k == "memsize" {
|
||||
desiredMem, err = strconv.ParseUint(v, 10, 64)
|
||||
if err != nil {
|
||||
errs = append(errs, fmt.Errorf("Error parsing string: %s", err))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
|
|||
errs = packer.MultiErrorAppend(errs, b.config.ShutdownConfig.Prepare(&b.config.ctx)...)
|
||||
errs = packer.MultiErrorAppend(errs, b.config.SSHConfig.Prepare(&b.config.ctx)...)
|
||||
errs = packer.MultiErrorAppend(errs, b.config.ToolsConfig.Prepare(&b.config.ctx)...)
|
||||
errs = packer.MultiErrorAppend(errs, b.config.VMXConfig.Prepare(&b.config.ctx, b.config.RemoteType)...)
|
||||
errs = packer.MultiErrorAppend(errs, b.config.VMXConfig.Prepare(&b.config.ctx)...)
|
||||
|
||||
if b.config.DiskName == "" {
|
||||
b.config.DiskName = "disk"
|
||||
|
@ -171,12 +171,10 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
|
|||
}
|
||||
}
|
||||
|
||||
// Determine if DiskSize is able to be allocated, only when running locally
|
||||
if b.config.RemoteType == "" {
|
||||
if err = common.AvailableDisk(uint64(b.config.DiskSize)); err != nil {
|
||||
errs = packer.MultiErrorAppend(errs,
|
||||
fmt.Errorf("Unavailable Resources: %s", err))
|
||||
}
|
||||
// Determine if DiskSize is able to be allocated
|
||||
if err = common.AvailableDisk(uint64(b.config.DiskSize)); err != nil {
|
||||
errs = packer.MultiErrorAppend(errs,
|
||||
fmt.Errorf("Unavailable Resources: %s", err))
|
||||
}
|
||||
|
||||
// Warnings
|
||||
|
|
|
@ -63,7 +63,7 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
|
|||
errs = packer.MultiErrorAppend(errs, c.ShutdownConfig.Prepare(&c.ctx)...)
|
||||
errs = packer.MultiErrorAppend(errs, c.SSHConfig.Prepare(&c.ctx)...)
|
||||
errs = packer.MultiErrorAppend(errs, c.ToolsConfig.Prepare(&c.ctx)...)
|
||||
errs = packer.MultiErrorAppend(errs, c.VMXConfig.Prepare(&c.ctx, c.RemoteType)...)
|
||||
errs = packer.MultiErrorAppend(errs, c.VMXConfig.Prepare(&c.ctx)...)
|
||||
|
||||
if c.SourcePath == "" {
|
||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("source_path is blank, but is required"))
|
||||
|
|
Loading…
Reference in New Issue