From 1851223ad24c35ecaf8f8145e34ec49d04b5c98c Mon Sep 17 00:00:00 2001 From: Andrei Tonkikh Date: Thu, 1 Feb 2018 15:50:12 +0300 Subject: [PATCH] Make disk_size mandatory parameter for iso builder --- iso/builder_acc_test.go | 4 +++- iso/config.go | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index d1c94c67c..14cc6a6cc 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -31,7 +31,9 @@ func defaultConfig() map[string]interface{} { "ssh_username": "root", "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 } diff --git a/iso/config.go b/iso/config.go index 6646d3235..2b29c67ba 100644 --- a/iso/config.go +++ b/iso/config.go @@ -6,6 +6,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/template/interpolate" "github.com/jetbrains-infra/packer-builder-vsphere/common" + "fmt" ) 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.ConnectConfig.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.CreateConfig.Prepare()...)