Merge pull request #7406 from blackpiglet/fix_velero_repo_get_bug

Fix the `velero repo get` nil pointer issue.
This commit is contained in:
qiuming
2024-02-19 10:54:19 +08:00
committed by GitHub

View File

@@ -43,9 +43,8 @@ func NewGetCommand(f client.Factory, use string) *cobra.Command {
crClient, err := f.KubebuilderClient()
cmd.CheckError(err)
var repos *api.BackupRepositoryList
repos := new(api.BackupRepositoryList)
if len(args) > 0 {
repos = new(api.BackupRepositoryList)
for _, name := range args {
repo := new(api.BackupRepository)
err := crClient.Get(context.TODO(), ctrlclient.ObjectKey{Namespace: f.Namespace(), Name: name}, repo)