Skip to content

Commit 32499fc

Browse files
authored
Merge pull request #8546 from blackpiglet/skip_deprecation_message
Skip the deprecation message for the dry-run install CLI JSON output.
2 parents be14d4f + b281ddb commit 32499fc

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/util/velero/install.go

+10
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"fmt"
2424
"os"
2525
"os/exec"
26+
"strings"
2627
"time"
2728

2829
"github.com/pkg/errors"
@@ -413,6 +414,15 @@ func createVeleroResources(ctx context.Context, cli, namespace string, args []st
413414
return errors.Wrapf(err, "failed to run velero install dry run command, stdout=%s, stderr=%s", stdout, stderr)
414415
}
415416

417+
// From v1.15, the Restic uploader is deprecated,
418+
// and a warning message is printed for the install CLI.
419+
// Need to skip the deprecation of Restic message before the generated JSON.
420+
// Redirect to the stdout to the first curly bracket to skip the warning.
421+
if stdout[0] != '{' {
422+
newIndex := strings.Index(stdout, "{")
423+
stdout = stdout[newIndex:]
424+
}
425+
416426
resources := &unstructured.UnstructuredList{}
417427
if err := json.Unmarshal([]byte(stdout), resources); err != nil {
418428
return errors.Wrapf(err, "failed to unmarshal the resources: %s", stdout)

0 commit comments

Comments
 (0)