Merge pull request #2815 from TimeIncOSS/f-core-ids-in-apply-errors

core: Add resource IDs to apply-errors + prevent error duplication
This commit is contained in:
Radek Simko 2015-07-27 16:08:28 +01:00
commit 0a6da92791
3 changed files with 6 additions and 3 deletions

View File

@ -140,7 +140,8 @@ func (h *UiHook) PostApply(
} }
if applyerr != nil { if applyerr != nil {
msg = fmt.Sprintf("Error: %s", applyerr) // Errors are collected and printed in ApplyCommand, no need to duplicate
return terraform.HookActionContinue, nil
} }
h.ui.Output(h.Colorize.Color(fmt.Sprintf( h.ui.Output(h.Colorize.Color(fmt.Sprintf(

View File

@ -94,7 +94,8 @@ func (n *EvalApply) Eval(ctx EvalContext) (interface{}, error) {
// if we have one, otherwise we just output it. // if we have one, otherwise we just output it.
if err != nil { if err != nil {
if n.Error != nil { if n.Error != nil {
*n.Error = multierror.Append(*n.Error, err) helpfulErr := fmt.Errorf("%s: %s", n.Info.Id, err.Error())
*n.Error = multierror.Append(*n.Error, helpfulErr)
} else { } else {
return nil, err return nil, err
} }

View File

@ -1,6 +1,7 @@
package terraform package terraform
import ( import (
"fmt"
"log" "log"
) )
@ -35,7 +36,7 @@ func (n *EvalRefresh) Eval(ctx EvalContext) (interface{}, error) {
// Refresh! // Refresh!
state, err = provider.Refresh(n.Info, state) state, err = provider.Refresh(n.Info, state)
if err != nil { if err != nil {
return nil, err return nil, fmt.Errorf("%s: %s", n.Info.Id, err.Error())
} }
// Call post-refresh hook // Call post-refresh hook