Avoid wrapping failed PVB status with empty message.

Also change "get" to "found" as requested in issue #7857.

Signed-off-by: Matthew Arnold <marnold@redhat.com>
This commit is contained in:
Matthew Arnold
2024-07-18 15:57:11 -04:00
parent 55e027897c
commit c8a0c345dc
2 changed files with 7 additions and 2 deletions

View File

@@ -19,6 +19,7 @@ package controller
import (
"context"
"fmt"
"strings"
"time"
"github.com/pkg/errors"
@@ -373,7 +374,11 @@ func UpdatePVBStatusToFailed(ctx context.Context, c client.Client, pvb *velerov1
if dataPathError, ok := errOut.(datapath.DataPathError); ok {
pvb.Status.SnapshotID = dataPathError.GetSnapshotID()
}
pvb.Status.Message = errors.WithMessage(errOut, msg).Error()
if len(strings.TrimSpace(msg)) == 0 {
pvb.Status.Message = errOut.Error()
} else {
pvb.Status.Message = errors.WithMessage(errOut, msg).Error()
}
err := c.Patch(ctx, pvb, client.MergeFrom(original))
if err != nil {
log.WithError(err).Error("error updating PodVolumeBackup status")