Skip to content

Commit

Permalink
provisioner/remote-exec: Clear out scripts after uploading
Browse files Browse the repository at this point in the history
Prevents residual script contents from remaining on machine.

Fixes #483
  • Loading branch information
phinze committed Mar 11, 2016
1 parent 14ca7e3 commit a142af3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions builtin/provisioners/remote-exec/resource_provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit a142af3

Please sign in to comment.