Commit 5cac40b4 authored by Yuya Kusakabe's avatar Yuya Kusakabe

Fixes #1106, Remote ESXi builder doesn't upload floppy

parent 12e28f25
...@@ -334,6 +334,10 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe ...@@ -334,6 +334,10 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
&common.StepCreateFloppy{ &common.StepCreateFloppy{
Files: b.config.FloppyFiles, Files: b.config.FloppyFiles,
}, },
&stepRemoteUpload{
Key: "floppy_path",
Message: "Uploading Floppy to remote machine...",
},
&stepRemoteUpload{ &stepRemoteUpload{
Key: "iso_path", Key: "iso_path",
Message: "Uploading ISO to remote machine...", Message: "Uploading ISO to remote machine...",
......
...@@ -260,6 +260,9 @@ func (d *ESX5Driver) String() string { ...@@ -260,6 +260,9 @@ func (d *ESX5Driver) String() string {
} }
func (d *ESX5Driver) datastorePath(path 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) return filepath.Join("/vmfs/volumes", d.Datastore, path)
} }
......
...@@ -24,8 +24,12 @@ func (s *stepRemoteUpload) Run(state multistep.StateBag) multistep.StepAction { ...@@ -24,8 +24,12 @@ func (s *stepRemoteUpload) Run(state multistep.StateBag) multistep.StepAction {
return multistep.ActionContinue return multistep.ActionContinue
} }
path, ok := state.Get(s.Key).(string)
if !ok {
return multistep.ActionContinue
}
ui.Say(s.Message) ui.Say(s.Message)
path := state.Get(s.Key).(string)
log.Printf("Remote uploading: %s", path) log.Printf("Remote uploading: %s", path)
newPath, err := remote.UploadISO(path) newPath, err := remote.UploadISO(path)
if err != nil { if err != nil {
......
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