Make disk_size mandatory parameter for iso builder

This commit is contained in:
Andrei Tonkikh 2018-02-01 15:50:12 +03:00
parent 9c4d5c6c59
commit 1851223ad2
2 changed files with 7 additions and 1 deletions

View File

@ -32,6 +32,8 @@ func defaultConfig() map[string]interface{} {
"ssh_password": "jetbrains", "ssh_password": "jetbrains",
"vm_name": commonT.NewVMName(), "vm_name": commonT.NewVMName(),
"disk_size": 2,
"communicator": "none", // do not start the VM without any bootable devices "communicator": "none", // do not start the VM without any bootable devices
} }

View File

@ -6,6 +6,7 @@ import (
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/template/interpolate" "github.com/hashicorp/packer/template/interpolate"
"github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/common"
"fmt"
) )
type Config struct { type Config struct {
@ -35,6 +36,9 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
errs = packer.MultiErrorAppend(errs, c.RunConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.RunConfig.Prepare()...)
errs = packer.MultiErrorAppend(errs, c.ConnectConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.ConnectConfig.Prepare()...)
errs = packer.MultiErrorAppend(errs, c.HardwareConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.HardwareConfig.Prepare()...)
if c.DiskSize <= 0 {
errs = packer.MultiErrorAppend(errs, fmt.Errorf("'disk_size' must be provided"))
}
errs = packer.MultiErrorAppend(errs, c.ShutdownConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.ShutdownConfig.Prepare()...)
errs = packer.MultiErrorAppend(errs, c.CreateConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.CreateConfig.Prepare()...)