backend/local: fix crash (in tests) due to not guarding nil CLI

This commit is contained in:
Mitchell Hashimoto 2017-01-18 21:41:59 -08:00
parent d3633ab368
commit 31f7cca77f
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
1 changed files with 4 additions and 1 deletions

View File

@ -51,7 +51,10 @@ func (b *Local) opPlan(
if op.PlanRefresh {
log.Printf("[INFO] backend/local: plan calling Refresh")
b.CLI.Output(b.Colorize().Color(strings.TrimSpace(planRefreshing) + "\n"))
if b.CLI != nil {
b.CLI.Output(b.Colorize().Color(strings.TrimSpace(planRefreshing) + "\n"))
}
_, err := tfCtx.Refresh()
if err != nil {
runningOp.Err = errwrap.Wrapf("Error refreshing state: {{err}}", err)