command/build: output warnings

This commit is contained in:
Mitchell Hashimoto 2013-11-02 23:20:27 -05:00
parent f40a6e21aa
commit 4b76b8f0a7
1 changed files with 10 additions and 2 deletions

View File

@ -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