diff --git a/pkg/cmd/cli/restore/create.go b/pkg/cmd/cli/restore/create.go index 44ebc6f70e..f30ee13071 100644 --- a/pkg/cmd/cli/restore/create.go +++ b/pkg/cmd/cli/restore/create.go @@ -171,11 +171,11 @@ func (o *CreateOptions) Validate(c *cobra.Command, args []string, f client.Facto return err } case o.ScheduleName != "": - scheduleItems, err := o.client.VeleroV1().Backups(f.Namespace()).List(metav1.ListOptions{LabelSelector: fmt.Sprintf("%s=%s", api.ScheduleNameLabel, o.ScheduleName)}) + backupItems, err := o.client.VeleroV1().Backups(f.Namespace()).List(metav1.ListOptions{LabelSelector: fmt.Sprintf("%s=%s", api.ScheduleNameLabel, o.ScheduleName)}) if err != nil { return err } - if len(scheduleItems.Items) == 0 { + if len(backupItems.Items) == 0 { return errors.Errorf("No backups found for the schedule %s", o.ScheduleName) } }