Skip to content

Commit

Permalink
Merge pull request #5412 from allenxu404/i5085
Browse files Browse the repository at this point in the history
Change B/R describe CLI to support kopia
  • Loading branch information
blackpiglet authored Oct 3, 2022
2 parents a80c96c + 47f8eb5 commit f3e3cfc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/5412-allenxu404
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Change B/R describe CLI to support Kopia
13 changes: 11 additions & 2 deletions pkg/cmd/util/output/backup_describer.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,10 +403,19 @@ func failedDeletionCount(requests []velerov1api.DeleteBackupRequest) int {

// DescribePodVolumeBackups describes pod volume backups in human-readable format.
func DescribePodVolumeBackups(d *Describer, backups []velerov1api.PodVolumeBackup, details bool) {
// Get the type of pod volume uploader. Since the uploader only comes from a single source, we can
// take the uploader type from the first element of the array.
var uploaderType string
if len(backups) > 0 {
uploaderType = backups[0].Spec.UploaderType
} else {
return
}

if details {
d.Printf("Restic Backups:\n")
d.Printf("%s Backups:\n", uploaderType)
} else {
d.Printf("Restic Backups (specify --details for more information):\n")
d.Printf("%s Backups (specify --details for more information):\n", uploaderType)
}

// separate backups by phase (combining <none> and New into a single group)
Expand Down
13 changes: 11 additions & 2 deletions pkg/cmd/util/output/restore_describer.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,19 @@ func describeRestoreResult(d *Describer, name string, result pkgrestore.Result)

// describePodVolumeRestores describes pod volume restores in human-readable format.
func describePodVolumeRestores(d *Describer, restores []velerov1api.PodVolumeRestore, details bool) {
// Get the type of pod volume uploader. Since the uploader only comes from a single source, we can
// take the uploader type from the first element of the array.
var uploaderType string
if len(restores) > 0 {
uploaderType = restores[0].Spec.UploaderType
} else {
return
}

if details {
d.Printf("Restic Restores:\n")
d.Printf("%s Restores:\n", uploaderType)
} else {
d.Printf("Restic Restores (specify --details for more information):\n")
d.Printf("%s Restores (specify --details for more information):\n", uploaderType)
}

// separate restores by phase (combining <none> and New into a single group)
Expand Down

0 comments on commit f3e3cfc

Please sign in to comment.