diff --git a/provisioner/salt-masterless/provisioner.go b/provisioner/salt-masterless/provisioner.go index 4f530f975..83bc326fb 100644 --- a/provisioner/salt-masterless/provisioner.go +++ b/provisioner/salt-masterless/provisioner.go @@ -399,9 +399,14 @@ func (p *Provisioner) uploadFile(ui packer.Ui, comm packer.Communicator, dst, sr } defer f.Close() - if err = comm.Upload(dst, f, nil); err != nil { + _, temp_dst := filepath.Split(dst) + + if err = comm.Upload(temp_dst, f, nil); err != nil { return fmt.Errorf("Error uploading %s: %s", src, err) } + + p.moveFile(ui, comm, dst, temp_dst) + return nil } @@ -468,14 +473,9 @@ func (p *Provisioner) removeDir(ui packer.Ui, comm packer.Communicator, dir stri } func (p *Provisioner) uploadDir(ui packer.Ui, comm packer.Communicator, dst, src string, ignore []string) error { - if err := p.createDir(ui, comm, dst); err != nil { + _, temp_dst := filepath.Split(dst) + if err := comm.UploadDir(temp_dst, src, ignore); err != nil { return err } - - // Make sure there is a trailing "/" so that the directory isn't - // created on the other side. - if src[len(src)-1] != '/' { - src = src + "/" - } - return comm.UploadDir(dst, src, ignore) + return p.moveFile(ui, comm, dst, temp_dst) }