From 9b30c9aed0fc7aaed71b5197ce9422b8b8e3d18f Mon Sep 17 00:00:00 2001 From: Ali Rizvi-Santiago Date: Mon, 11 Jun 2018 17:53:54 -0500 Subject: [PATCH] Allow StepAttachIso in the VirtualBox builder to resolve symbolic links when processing the IsoPath. This just closes out a really old issue (#3437) by using `filepath.EvalSymLinks` to resolve the symbolic link that the user specifies for the IsoPath. --- builder/virtualbox/iso/step_attach_iso.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/builder/virtualbox/iso/step_attach_iso.go b/builder/virtualbox/iso/step_attach_iso.go index 619d61afd..928a76761 100644 --- a/builder/virtualbox/iso/step_attach_iso.go +++ b/builder/virtualbox/iso/step_attach_iso.go @@ -34,6 +34,16 @@ func (s *stepAttachISO) Run(_ context.Context, state multistep.StateBag) multist device = "0" } + // If it's a symlink, resolve it to it's target. + resolvedIsoPath, err := filepath.EvalSymlinks(isoPath) + if err != nil { + err := fmt.Errorf("Error resolving symlink for ISO: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + isoPath = resolvedIsoPath + // Attach the disk to the controller command := []string{ "storageattach", vmName,