From 5cac40b47c90a820aee2b1c5ef4cd45544012f5e Mon Sep 17 00:00:00 2001 From: Yuya Kusakabe Date: Sat, 3 May 2014 18:23:20 +0900 Subject: [PATCH] Fixes #1106, Remote ESXi builder doesn't upload floppy --- builder/vmware/iso/builder.go | 4 ++++ builder/vmware/iso/driver_esx5.go | 3 +++ builder/vmware/iso/step_remote_upload.go | 6 +++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/builder/vmware/iso/builder.go b/builder/vmware/iso/builder.go index 06884ad89..2fb24b90d 100644 --- a/builder/vmware/iso/builder.go +++ b/builder/vmware/iso/builder.go @@ -334,6 +334,10 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe &common.StepCreateFloppy{ Files: b.config.FloppyFiles, }, + &stepRemoteUpload{ + Key: "floppy_path", + Message: "Uploading Floppy to remote machine...", + }, &stepRemoteUpload{ Key: "iso_path", Message: "Uploading ISO to remote machine...", diff --git a/builder/vmware/iso/driver_esx5.go b/builder/vmware/iso/driver_esx5.go index c99376a66..2e9375859 100644 --- a/builder/vmware/iso/driver_esx5.go +++ b/builder/vmware/iso/driver_esx5.go @@ -260,6 +260,9 @@ func (d *ESX5Driver) String() string { } func (d *ESX5Driver) datastorePath(path string) string { + if filepath.IsAbs(path) { + return filepath.Join("/vmfs/volumes", d.Datastore, strings.Replace(path, "/", "", 1)) + } return filepath.Join("/vmfs/volumes", d.Datastore, path) } diff --git a/builder/vmware/iso/step_remote_upload.go b/builder/vmware/iso/step_remote_upload.go index 717b3dc13..e739196ab 100644 --- a/builder/vmware/iso/step_remote_upload.go +++ b/builder/vmware/iso/step_remote_upload.go @@ -24,8 +24,12 @@ func (s *stepRemoteUpload) Run(state multistep.StateBag) multistep.StepAction { return multistep.ActionContinue } + path, ok := state.Get(s.Key).(string) + if !ok { + return multistep.ActionContinue + } + ui.Say(s.Message) - path := state.Get(s.Key).(string) log.Printf("Remote uploading: %s", path) newPath, err := remote.UploadISO(path) if err != nil {