From 9c4d5c6c59f1e26588080282858c0da4705f36f3 Mon Sep 17 00:00:00 2001 From: Andrei Tonkikh Date: Thu, 1 Feb 2018 15:48:30 +0300 Subject: [PATCH] Cleanup after cf198539e8a195925a7e0b49ef535e89b148a1c3 --- driver/vm.go | 2 +- iso/builder_acc_test.go | 17 +---------------- iso/step_add_floppy.go | 3 +-- 3 files changed, 3 insertions(+), 19 deletions(-) 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 }