From 443ccc53061c5429d8024f7d2648adc83ac63261 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 23 Aug 2013 14:39:59 -0700 Subject: [PATCH] packer/rpc: don't panic on failed Ui calls --- communicator/ssh/communicator.go | 2 +- packer/rpc/ui.go | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/communicator/ssh/communicator.go b/communicator/ssh/communicator.go index 6a10d2299..c59b91892 100644 --- a/communicator/ssh/communicator.go +++ b/communicator/ssh/communicator.go @@ -160,7 +160,7 @@ func (c *comm) Upload(path string, input io.Reader) error { return err } - if _, err := io.Copy(w, input_memory); err != nil{ + if _, err := io.Copy(w, input_memory); err != nil { return err } diff --git a/packer/rpc/ui.go b/packer/rpc/ui.go index 617541dde..4d7ccc57f 100644 --- a/packer/rpc/ui.go +++ b/packer/rpc/ui.go @@ -2,6 +2,7 @@ package rpc import ( "github.com/mitchellh/packer/packer" + "log" "net/rpc" ) @@ -30,7 +31,7 @@ func (u *Ui) Ask(query string) (result string, err error) { func (u *Ui) Error(message string) { if err := u.client.Call("Ui.Error", message, new(interface{})); err != nil { - panic(err) + log.Printf("Error in Ui RPC call: %s", err) } } @@ -41,19 +42,19 @@ func (u *Ui) Machine(t string, args ...string) { } if err := u.client.Call("Ui.Machine", rpcArgs, new(interface{})); err != nil { - panic(err) + log.Printf("Error in Ui RPC call: %s", err) } } func (u *Ui) Message(message string) { if err := u.client.Call("Ui.Message", message, new(interface{})); err != nil { - panic(err) + log.Printf("Error in Ui RPC call: %s", err) } } func (u *Ui) Say(message string) { if err := u.client.Call("Ui.Say", message, new(interface{})); err != nil { - panic(err) + log.Printf("Error in Ui RPC call: %s", err) } }