diff --git a/driver/vm.go b/driver/vm.go index edd79dbb4..e9a3d0727 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -350,7 +350,7 @@ func (vm *VirtualMachine) GetDir() (string, error) { vmxName := fmt.Sprintf("/%s.vmx", vmInfo.Name) for _, file := range vmInfo.LayoutEx.File { if strings.HasSuffix(file.Name, vmxName) { - return file.Name[:len(file.Name)-len(vmxName)], nil + return RemoveDatastorePrefix(file.Name[:len(file.Name)-len(vmxName)]), nil } } return "", fmt.Errorf("cannot find '%s'", vmxName) diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index 57a09a482..d1c94c67c 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -241,14 +241,12 @@ func TestISOBuilderAcc_createFloppy(t *testing.T) { if err != nil { t.Fatalf("Error creating temp file ") } - content := "Hello, World!" - fmt.Fprint(tmpFile, content) + fmt.Fprint(tmpFile, "Hello, World!") tmpFile.Close() builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: createFloppyConfig(tmpFile.Name()), - Check: checkCreateFloppy(t, content), }) } @@ -257,16 +255,3 @@ func createFloppyConfig(filePath string) string { config["floppy_files"] = []string{filePath} return commonT.RenderConfig(config) } - -func checkCreateFloppy(t *testing.T, content string) builderT.TestCheckFunc { - return func(artifacts []packer.Artifact) error { - d := commonT.TestConn(t) - - vm := commonT.GetVM(t, d, artifacts) - _, err := vm.GetDir() - if err != nil { - t.Fatalf(err.Error()) - } - return nil - } -} diff --git a/iso/step_add_floppy.go b/iso/step_add_floppy.go index f9efa5f20..a43eeb54e 100644 --- a/iso/step_add_floppy.go +++ b/iso/step_add_floppy.go @@ -63,7 +63,6 @@ func (s *StepAddFloppy) runImpl(state multistep.StateBag) error { if err != nil { return err } - vmDir = driver.RemoveDatastorePrefix(vmDir) uploadPath := fmt.Sprintf("%v/packer-tmp-created-floppy.img", vmDir) if err := ds.UploadFile(tmpFloppy.(string), uploadPath); err != nil { @@ -104,5 +103,5 @@ func (s *StepAddFloppy) Cleanup(state multistep.StateBag) { return } - // TODO: remove Floppy device, or eject the img + // the img will be automatically ejected }