Commit c264ef0a authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builer/virtualbox: avoid crash since guest additions path not set

parent 675f7a43
......@@ -25,7 +25,6 @@ type stepAttachGuestAdditions struct {
func (s *stepAttachGuestAdditions) Run(state multistep.StateBag) multistep.StepAction {
config := state.Get("config").(*config)
driver := state.Get("driver").(Driver)
guestAdditionsPath := state.Get("guest_additions_path").(string)
ui := state.Get("ui").(packer.Ui)
vmName := state.Get("vmName").(string)
......@@ -35,6 +34,9 @@ func (s *stepAttachGuestAdditions) Run(state multistep.StateBag) multistep.StepA
return multistep.ActionContinue
}
// Get the guest additions path since we're doing it
guestAdditionsPath := state.Get("guest_additions_path").(string)
// Attach the guest additions to the computer
log.Println("Attaching guest additions ISO onto IDE controller...")
command := []string{
......
......@@ -19,7 +19,6 @@ func (s *stepUploadGuestAdditions) Run(state multistep.StateBag) multistep.StepA
comm := state.Get("communicator").(packer.Communicator)
config := state.Get("config").(*config)
driver := state.Get("driver").(Driver)
guestAdditionsPath := state.Get("guest_additions_path").(string)
ui := state.Get("ui").(packer.Ui)
// If we're attaching then don't do this, since we attached.
......@@ -28,6 +27,9 @@ func (s *stepUploadGuestAdditions) Run(state multistep.StateBag) multistep.StepA
return multistep.ActionContinue
}
// Get the guest additions path since we're doing it
guestAdditionsPath := state.Get("guest_additions_path").(string)
version, err := driver.Version()
if err != nil {
state.Put("error", fmt.Errorf("Error reading version for guest additions upload: %s", err))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment