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.
This commit is contained in:
Ali Rizvi-Santiago 2018-06-11 17:53:54 -05:00 committed by GitHub
parent 9d97365522
commit 9b30c9aed0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -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,