Cleanup after cf198539e8
This commit is contained in:
parent
cf198539e8
commit
9c4d5c6c59
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue