Skip to content

fix: use -no-color when calling terraform show state #4812

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion provisioner/terraform/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions provisionerd/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -248,9 +251,6 @@ func (r *Runner) doCleanFinish(ctx context.Context) {
completedJob *proto.CompletedJob
)

ctx, span := r.startTrace(ctx, tracing.FuncName())
defer span.End()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this was removed but seems like it should be fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was originally going in to change this but then I found the -no-color issue so I bundled them up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having doCleanFinish be a super long span didn't seem that useful since everything else inside of it was already traced.
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you mean. I guess it gives a better idea of how the code is structured, but not a necessity if you feel cleanliness wins here 👍🏻.


// push the fail/succeed write onto the defer stack before the cleanup, so
// that cleanup happens before this.
defer func() {
Expand Down