Skip to content

Commit 8f541a0

Browse files
bundle/phases: surface Release errors via logdiag (restore pre-refactor semantics)
The original release.go mutator returned diag.FromErr on unlock failure, which surfaced as an error diagnostic to the user. The defer pattern introduced in #5314 dropped it to log.Warnf — a silent demotion that would hide a stuck lock from the user (who normally has to recover with --force-lock). Switch the defer to logdiag.LogError so the unlock failure shows up as a proper diagnostic, matching the pre-refactor behavior. The deploy/destroy/ bind/unbind phases all share the same fix. Co-authored-by: Isaac
1 parent 0433a83 commit 8f541a0

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

bundle/phases/bind.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func Bind(ctx context.Context, b *bundle.Bundle, opts *terraform.BindOptions, en
3535
status = lock.DeploymentFailure
3636
}
3737
if err := dl.Release(ctx, status); err != nil {
38-
log.Warnf(ctx, "Failed to release deployment lock: %v", err)
38+
logdiag.LogError(ctx, err)
3939
}
4040
}()
4141

@@ -138,7 +138,7 @@ func Unbind(ctx context.Context, b *bundle.Bundle, bundleType, tfResourceType, r
138138
status = lock.DeploymentFailure
139139
}
140140
if err := dl.Release(ctx, status); err != nil {
141-
log.Warnf(ctx, "Failed to release deployment lock: %v", err)
141+
logdiag.LogError(ctx, err)
142142
}
143143
}()
144144

bundle/phases/deploy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func Deploy(ctx context.Context, b *bundle.Bundle, outputHandler sync.OutputHand
144144
status = lock.DeploymentFailure
145145
}
146146
if err := dl.Release(ctx, status); err != nil {
147-
log.Warnf(ctx, "Failed to release deployment lock: %v", err)
147+
logdiag.LogError(ctx, err)
148148
}
149149
}()
150150

bundle/phases/destroy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ func Destroy(ctx context.Context, b *bundle.Bundle, engine engine.EngineType) {
132132
status = lock.DeploymentFailure
133133
}
134134
if err := dl.Release(ctx, status); err != nil {
135-
log.Warnf(ctx, "Failed to release deployment lock: %v", err)
135+
logdiag.LogError(ctx, err)
136136
}
137137
}()
138138

0 commit comments

Comments
 (0)