Skip to content

Commit

Permalink
controller: strip newlines from Helm error message
Browse files Browse the repository at this point in the history
To prevent spurious newlines between the error message and the captured
logs, as at times Helm ends error with one or multiple newlines.

Signed-off-by: Hidde Beydals <[email protected]>
  • Loading branch information
hiddeco committed Sep 11, 2023
1 parent eb3a4b8 commit 1aa7390
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/controller/helmrelease_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ func (r *HelmReleaseReconciler) handleHelmActionResult(ctx context.Context,
err = fmt.Errorf("Helm %s failed: %w", action, err)
msg := err.Error()
if actionErr := (*runner.ActionError)(nil); errors.As(err, &actionErr) {
msg = msg + "\n\nLast Helm logs:\n\n" + actionErr.CapturedLogs
msg = strings.TrimSpace(msg) + "\n\nLast Helm logs:\n\n" + actionErr.CapturedLogs
}
newCondition := metav1.Condition{
Type: condition,
Expand Down

0 comments on commit 1aa7390

Please sign in to comment.