command/build: output warnings
This commit is contained in:
parent
f40a6e21aa
commit
4b76b8f0a7
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue