Merge pull request #5577 from hashicorp/phinze/remote-exec-empty-file

provisioner/remote-exec: Clear out scripts after uploading
This commit is contained in:
Paul Hinze 2016-03-14 09:54:13 -05:00
commit 76377c9883
1 changed files with 7 additions and 0 deletions

View File

@ -192,6 +192,13 @@ func (p *ResourceProvisioner) runScripts(
return fmt.Errorf("Error starting script: %v", err)
}
// Upload a blank follow up file in the same path to prevent residual
// script contents from remaining on remote machine
empty := bytes.NewReader([]byte(""))
if err := comm.Upload(remotePath, empty); err != nil {
return fmt.Errorf("Failed to upload empty follow up script: %v", err)
}
return nil
})
if err == nil {