From ed75091bd441fbf897fd11dbfa33f3e97c5122f0 Mon Sep 17 00:00:00 2001 From: Mark Peek Date: Wed, 17 Jul 2013 18:17:46 -0700 Subject: [PATCH] Log an upload error closer to when it occurs When there is an error returned from the Upload it is propagated back to the main loop and may have additional log messages before the actual error is displayed. This displays a log message close to where the error actually occurred. --- provisioner/file/provisioner.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/provisioner/file/provisioner.go b/provisioner/file/provisioner.go index 1a9a3589b..25811dbb9 100644 --- a/provisioner/file/provisioner.go +++ b/provisioner/file/provisioner.go @@ -79,5 +79,9 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error { } defer f.Close() - return comm.Upload(p.config.Destination, f) + err = comm.Upload(p.config.Destination, f) + if err != nil { + ui.Error(fmt.Sprintf("Upload failed: %s", err)) + } + return err }