mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-04 12:14:00 +00:00
Skip the deprecation message for the dry-run install CLI JSON output.
Signed-off-by: Xun Jiang <xun.jiang@broadcom.com>
This commit is contained in:
@@ -23,6 +23,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
@@ -413,6 +414,15 @@ func createVeleroResources(ctx context.Context, cli, namespace string, args []st
|
||||
return errors.Wrapf(err, "failed to run velero install dry run command, stdout=%s, stderr=%s", stdout, stderr)
|
||||
}
|
||||
|
||||
// From v1.15, the Restic uploader is deprecated,
|
||||
// and a warning message is printed for the install CLI.
|
||||
// Need to skip the deprecation of Restic message before the generated JSON.
|
||||
// Redirect to the stdout to the first curly bracket to skip the warning.
|
||||
if stdout[0] != '{' {
|
||||
newIndex := strings.Index(stdout, "{")
|
||||
stdout = stdout[newIndex:]
|
||||
}
|
||||
|
||||
resources := &unstructured.UnstructuredList{}
|
||||
if err := json.Unmarshal([]byte(stdout), resources); err != nil {
|
||||
return errors.Wrapf(err, "failed to unmarshal the resources: %s", stdout)
|
||||
|
||||
Reference in New Issue
Block a user