pass file info during shell file upload

This commit is contained in:
Matthew Hooker 2018-03-20 16:28:54 -07:00
parent 67c7b9d152
commit 732a532d0e
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
1 changed files with 2 additions and 1 deletions

View File

@ -230,6 +230,7 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
return fmt.Errorf("Error opening shell script: %s", err)
}
defer f.Close()
info, _ := f.Stat()
// Compile the command
p.config.ctx.Data = &ExecuteCommandTemplate{
@ -257,7 +258,7 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
r = &UnixReader{Reader: r}
}
if err := comm.Upload(p.config.RemotePath, r, nil); err != nil {
if err := comm.Upload(p.config.RemotePath, r, &info); err != nil {
return fmt.Errorf("Error uploading script: %s", err)
}