From 4b76b8f0a709d860e733ea90a85f46f9b276f4f5 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 2 Nov 2013 23:20:27 -0500 Subject: [PATCH] command/build: output warnings --- command/build/command.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/command/build/command.go b/command/build/command.go index 1c0f7b2f1..4a1e7c283 100644 --- a/command/build/command.go +++ b/command/build/command.go @@ -113,12 +113,20 @@ func (c Command) Run(env packer.Environment, args []string) int { log.Printf("Preparing build: %s", b.Name()) b.SetDebug(cfgDebug) b.SetForce(cfgForce) - // TODO(mitchellh): Handle warnings - _, err := b.Prepare(userVars) + + warnings, err := b.Prepare(userVars) if err != nil { env.Ui().Error(err.Error()) return 1 } + if len(warnings) > 0 { + ui := buildUis[b.Name()] + ui.Say(fmt.Sprintf("Warnings for build '%s':\n", b.Name())) + for _, warning := range warnings { + ui.Say(fmt.Sprintf("* %s", warning)) + } + ui.Say("") + } } // Run all the builds in parallel and wait for them to complete