diff --git a/CHANGELOG.md b/CHANGELOG.md index 66bfd5ee0..fb1af8ac1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ IMPROVEMENTS: [GH-687] * builder/virtualbox: Nice errors if Packer can't write to the output directory. +* builder/virtualbox: ISO is ejected prior to export. * provisioner/puppet-masterless: Can now specify a `manifest_dir` to upload manifests to the remote machine for imports. [GH-655] diff --git a/builder/virtualbox/driver.go b/builder/virtualbox/driver.go index d16320f48..09ace38d9 100644 --- a/builder/virtualbox/driver.go +++ b/builder/virtualbox/driver.go @@ -106,6 +106,9 @@ func (d *VBox42Driver) Stop(name string) error { return err } + // We sleep here for a little bit to let the session "unlock" + time.Sleep(2 * time.Second) + return nil } diff --git a/builder/virtualbox/step_attach_iso.go b/builder/virtualbox/step_attach_iso.go index a71b6de6e..502fa3d0e 100644 --- a/builder/virtualbox/step_attach_iso.go +++ b/builder/virtualbox/step_attach_iso.go @@ -60,7 +60,7 @@ func (s *stepAttachISO) Cleanup(state multistep.StateBag) { "--medium", "none", } - if err := driver.VBoxManage(command...); err != nil { - ui.Error(fmt.Sprintf("Error unregistering ISO: %s", err)) - } + // Remove the ISO. Note that this will probably fail since + // stepRemoveDevices does this as well. No big deal. + driver.VBoxManage(command...) }