From 49bd57ee1209a19de2320ab848af9e3634821368 Mon Sep 17 00:00:00 2001 From: Joshua Foster Date: Thu, 13 Feb 2020 14:03:07 -0500 Subject: [PATCH 1/2] add the remote iso first so that it is first in boot order --- builder/vsphere/iso/step_add_cdrom.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/builder/vsphere/iso/step_add_cdrom.go b/builder/vsphere/iso/step_add_cdrom.go index 068d9ce4c..5a0160c12 100644 --- a/builder/vsphere/iso/step_add_cdrom.go +++ b/builder/vsphere/iso/step_add_cdrom.go @@ -49,6 +49,13 @@ func (s *StepAddCDRom) Run(_ context.Context, state multistep.StateBag) multiste } ui.Say("Mounting ISO images...") + if path, ok := state.GetOk("iso_remote_path"); ok { + if err := vm.AddCdrom(s.Config.CdromType, path.(string)); err != nil { + state.Put("error", fmt.Errorf("error mounting an image '%v': %v", path, err)) + return multistep.ActionHalt + } + } + if len(s.Config.ISOPaths) > 0 { for _, path := range s.Config.ISOPaths { if err := vm.AddCdrom(s.Config.CdromType, path); err != nil { @@ -57,13 +64,6 @@ func (s *StepAddCDRom) Run(_ context.Context, state multistep.StateBag) multiste } } } - - if path, ok := state.GetOk("iso_remote_path"); ok { - if err := vm.AddCdrom(s.Config.CdromType, path.(string)); err != nil { - state.Put("error", fmt.Errorf("error mounting an image '%v': %v", path, err)) - return multistep.ActionHalt - } - } return multistep.ActionContinue } From 8eac9f96348e70b0c3561eaef955ee39f8969125 Mon Sep 17 00:00:00 2001 From: Joshua Foster Date: Wed, 4 Mar 2020 21:48:51 -0500 Subject: [PATCH 2/2] add boot order documentation based on feedback --- .../docs/builders/vsphere-iso.html.md.erb | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/website/source/docs/builders/vsphere-iso.html.md.erb b/website/source/docs/builders/vsphere-iso.html.md.erb index bc09e4826..bbc339191 100644 --- a/website/source/docs/builders/vsphere-iso.html.md.erb +++ b/website/source/docs/builders/vsphere-iso.html.md.erb @@ -27,8 +27,7 @@ See complete Ubuntu, Windows, and macOS templates in the [examples folder](https There are many configuration options available for this builder. In addition to the items listed here, you will want to look at the general configuration -references for [ISO](#iso-configuration), -[HTTP](#http-directory-configuration), +references for [HTTP](#http-directory-configuration), [Floppy](#floppy-configuration), [Boot](#boot-configuration), [Driver](#driver-configuration), @@ -63,7 +62,35 @@ necessary for this build to succeed and can be found further down the page. ### Wait Configuration <%= partial "partials/builder/vsphere/common/WaitIpConfig-not-required" %> +### ISO Configuration + +<%= partial "partials/common/ISOConfig" %> + +#### Required: + +<%= partial "partials/common/ISOConfig-required" %> + +#### Optional: + +<%= partial "partials/common/ISOConfig-not-required" %> + ### CDRom Configuration + +Each iso defined in the CDRom Configuration adds a new drive. If the "iso_url" is defined in +addition to the "iso_paths", the "iso_url" is added to the VM first. This keeps the "iso_url" first in +the boot order by default allowing the boot iso being defined by the iso_url and the vmware tools iso added +from the datastore. Example: + +```json +"iso_urls": [ + "win10.iso", + "http://example.org/isos/win10.iso" +], +"iso_paths": [ + "[] /usr/lib/vmware/isoimages/windows.iso" +], +``` + <%= partial "partials/builder/vsphere/iso/CDRomConfig-not-required" %> ### Create Configuration