From 03cdac3028bcd2e4b613c37fd8db98ea8a62aecf Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 27 Aug 2013 15:03:49 -0700 Subject: [PATCH] command/build: build error machine-readable is targetted to the build --- command/build/command.go | 10 +++++++++- .../docs/machine-readable/command-build.html.markdown | 11 ++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/command/build/command.go b/command/build/command.go index a878627a5..b0e387c04 100644 --- a/command/build/command.go +++ b/command/build/command.go @@ -188,9 +188,17 @@ func (c Command) Run(env packer.Environment, args []string) int { if len(errors) > 0 { env.Ui().Machine("error-count", strconv.FormatInt(int64(len(errors)), 10)) + env.Ui().Error("\n==> Some builds didn't complete successfully and had errors:") for name, err := range errors { - env.Ui().Machine("error", name, err.Error()) + // Create a UI for the machine readable stuff to be targetted + ui := &packer.TargettedUi{ + Target: name, + Ui: env.Ui(), + } + + ui.Machine("error", err.Error()) + env.Ui().Error(fmt.Sprintf("--> %s: %s", name, err)) } } diff --git a/website/source/docs/machine-readable/command-build.html.markdown b/website/source/docs/machine-readable/command-build.html.markdown index 848d65c90..aac2713f9 100644 --- a/website/source/docs/machine-readable/command-build.html.markdown +++ b/website/source/docs/machine-readable/command-build.html.markdown @@ -147,18 +147,15 @@ of `packer build`.

-
error (2)
+
error (1)

- A build error that occurred. + A build error that occurred. The target of this output will be + the build that had the error.

- Data 1: name - The name of the build that had an error. -

- -

- Data 2: error - The error message as a string. + Data 1: error - The error message as a string.