diff --git a/provisioner/shell/provisioner.go b/provisioner/shell/provisioner.go index 3575c70cd..00a81bf30 100644 --- a/provisioner/shell/provisioner.go +++ b/provisioner/shell/provisioner.go @@ -320,6 +320,10 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error { p.config.RemotePath, err) } cmd.Wait() + // treat disconnects as retryable by returning an error + if cmd.ExitStatus == packer.CmdDisconnect { + return fmt.Errorf("Disconnect while removing temporary script.") + } return nil }) if err != nil {