From daa431af638d57d34dfcdfde35604417845f33ef Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 12 May 2013 16:25:40 -0700 Subject: [PATCH] packer: Communicator Upload/Download return an error --- packer/communicator.go | 4 ++-- packer/rpc/communicator.go | 8 ++++++-- packer/rpc/communicator_test.go | 8 ++++++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/packer/communicator.go b/packer/communicator.go index 57826298f..54df5b34b 100644 --- a/packer/communicator.go +++ b/packer/communicator.go @@ -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 diff --git a/packer/rpc/communicator.go b/packer/rpc/communicator.go index b7204f514..97d82360f 100644 --- a/packer/rpc/communicator.go +++ b/packer/rpc/communicator.go @@ -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. diff --git a/packer/rpc/communicator_test.go b/packer/rpc/communicator_test.go index 34ea4a9a2..adcfbf2e6 100644 --- a/packer/rpc/communicator_test.go +++ b/packer/rpc/communicator_test.go @@ -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)