packer: Communicator Upload/Download return an error

This commit is contained in:
Mitchell Hashimoto 2013-05-12 16:25:40 -07:00
parent 496a320a82
commit daa431af63
3 changed files with 14 additions and 6 deletions

View File

@ -13,8 +13,8 @@ import (
// Start or any other method may be called at the same time.
type Communicator interface {
Start(string) (*RemoteCommand, error)
Upload(string, io.Reader)
Download(string, io.Writer)
Upload(string, io.Reader) error
Download(string, io.Writer) error
}
// This struct contains some information about the remote command being

View File

@ -87,9 +87,13 @@ func (c *communicator) Start(cmd string) (rc *packer.RemoteCommand, err error) {
return
}
func (c *communicator) Upload(string, io.Reader) {}
func (c *communicator) Upload(string, io.Reader) error {
return nil
}
func (c *communicator) Download(string, io.Writer) {}
func (c *communicator) Download(string, io.Writer) error {
return nil
}
func (c *CommunicatorServer) Start(cmd *string, reply *CommunicatorStartResponse) (err error) {
// Start executing the command.

View File

@ -45,9 +45,13 @@ func (t *testCommunicator) Start(cmd string) (*packer.RemoteCommand, error) {
return rc, nil
}
func (t *testCommunicator) Upload(string, io.Reader) {}
func (t *testCommunicator) Upload(string, io.Reader) error {
return nil
}
func (t *testCommunicator) Download(string, io.Writer) {}
func (t *testCommunicator) Download(string, io.Writer) error {
return nil
}
func TestCommunicatorRPC(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true)