communicator/ssh: show more descriptive error if SCP not avail [GH-127]

This commit is contained in:
Mitchell Hashimoto 2013-07-07 12:23:32 -07:00
parent abc2bc60ab
commit eb009ca4e3
2 changed files with 11 additions and 0 deletions

View file

@ -9,6 +9,8 @@ FEATURES:
IMPROVEMENTS:
* core: If SCP is not available, a more descriptive error message
is shown telling the user. [GH-127]
* virtualbox: Delete the packer-made SSH port forwarding prior to
exporting the VM.

View file

@ -3,6 +3,7 @@ package ssh
import (
"bytes"
"code.google.com/p/go.crypto/ssh"
"errors"
"fmt"
"github.com/mitchellh/packer/packer"
"io"
@ -145,6 +146,14 @@ func (c *comm) Upload(path string, input io.Reader) error {
// Otherwise, we have an ExitErorr, meaning we can just read
// the exit status
log.Printf("non-zero exit status: %d", exitErr.ExitStatus())
// If we exited with status 127, it means SCP isn't available.
// Return a more descriptive error for that.
if exitErr.ExitStatus() == 127 {
return errors.New(
"SCP failed to start. This usually means that SCP is not\n" +
"properly installed on the remote system.")
}
}
return err