command/build: build error machine-readable is targetted to the build
This commit is contained in:
parent
3b097f9805
commit
03cdac3028
|
@ -188,9 +188,17 @@ func (c Command) Run(env packer.Environment, args []string) int {
|
||||||
|
|
||||||
if len(errors) > 0 {
|
if len(errors) > 0 {
|
||||||
env.Ui().Machine("error-count", strconv.FormatInt(int64(len(errors)), 10))
|
env.Ui().Machine("error-count", strconv.FormatInt(int64(len(errors)), 10))
|
||||||
|
|
||||||
env.Ui().Error("\n==> Some builds didn't complete successfully and had errors:")
|
env.Ui().Error("\n==> Some builds didn't complete successfully and had errors:")
|
||||||
for name, err := range 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))
|
env.Ui().Error(fmt.Sprintf("--> %s: %s", name, err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,18 +147,15 @@ of `packer build`.
|
||||||
</p>
|
</p>
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
<dt>error (2)</dt>
|
<dt>error (1)</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<p>
|
<p>
|
||||||
A build error that occurred.
|
A build error that occurred. The target of this output will be
|
||||||
|
the build that had the error.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<strong>Data 1: name</strong> - The name of the build that had an error.
|
<strong>Data 1: error</strong> - The error message as a string.
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<strong>Data 2: error</strong> - The error message as a string.
|
|
||||||
</p>
|
</p>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
Loading…
Reference in New Issue