Skip to content

Commit

Permalink
Merge pull request #2218 from cpanato/GH-1168
Browse files Browse the repository at this point in the history
remove schedule validation
  • Loading branch information
ashish-amarnath authored Jan 31, 2020
2 parents 1f2375a + 42b6126 commit 21264a1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelogs/unreleased/2218-cpanato
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
remove the schedule validation and instead of checking the schedule because we might be in another cluster we check if a backup exist with the schedule name.
6 changes: 5 additions & 1 deletion pkg/cmd/cli/restore/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,13 @@ func (o *CreateOptions) Validate(c *cobra.Command, args []string, f client.Facto
return err
}
case o.ScheduleName != "":
if _, err := o.client.VeleroV1().Schedules(f.Namespace()).Get(o.ScheduleName, metav1.GetOptions{}); err != nil {
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(backupItems.Items) == 0 {
return errors.Errorf("No backups found for the schedule %s", o.ScheduleName)
}
}

return nil
Expand Down

0 comments on commit 21264a1

Please sign in to comment.