From 29fb3754cd48efb00b3c592d5fc17457b89389d5 Mon Sep 17 00:00:00 2001 From: Colin Adler Date: Mon, 31 Oct 2022 12:45:28 -0500 Subject: [PATCH] fix: use `-no-color` when calling `terraform show state` --- provisioner/terraform/executor.go | 2 +- provisionerd/runner/runner.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/provisioner/terraform/executor.go b/provisioner/terraform/executor.go index 8a2d10727c5bf..3061f94519d84 100644 --- a/provisioner/terraform/executor.go +++ b/provisioner/terraform/executor.go @@ -342,7 +342,7 @@ func (e executor) stateResources(ctx, killCtx context.Context) ([]*proto.Resourc } func (e executor) state(ctx, killCtx context.Context) (*tfjson.State, error) { - args := []string{"show", "-json"} + args := []string{"show", "-json", "-no-color"} state := &tfjson.State{} err := e.execParseJSON(ctx, killCtx, args, e.basicEnv(), state) if err != nil { diff --git a/provisionerd/runner/runner.go b/provisionerd/runner/runner.go index c90df310576d1..18b7e881d7c82 100644 --- a/provisionerd/runner/runner.go +++ b/provisionerd/runner/runner.go @@ -233,6 +233,9 @@ func (r *Runner) ForceStop() { } func (r *Runner) update(ctx context.Context, u *proto.UpdateJobRequest) (*proto.UpdateJobResponse, error) { + ctx, span := r.startTrace(ctx, tracing.FuncName()) + defer span.End() + r.mutex.Lock() defer r.mutex.Unlock() if !r.okToSend { @@ -248,9 +251,6 @@ func (r *Runner) doCleanFinish(ctx context.Context) { completedJob *proto.CompletedJob ) - ctx, span := r.startTrace(ctx, tracing.FuncName()) - defer span.End() - // push the fail/succeed write onto the defer stack before the cleanup, so // that cleanup happens before this. defer func() {