Change B/R describe cli to support kopia

Signed-off-by: allenxu404 <qix2@vmware.com>
This commit is contained in:
allenxu404
2022-09-30 17:30:18 +08:00
parent 3f3a5050d6
commit 47f8eb5f9b
3 changed files with 25 additions and 6 deletions

View File

@@ -0,0 +1 @@
Change B/R describe CLI to support Kopia

View File

@@ -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) {
if details {
d.Printf("Restic Backups:\n")
// 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 {
d.Printf("Restic Backups (specify --details for more information):\n")
return
}
if details {
d.Printf("%s Backups:\n", uploaderType)
} else {
d.Printf("%s Backups (specify --details for more information):\n", uploaderType)
}
// separate backups by phase (combining <none> and New into a single group)

View File

@@ -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) {
if details {
d.Printf("Restic Restores:\n")
// 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 {
d.Printf("Restic Restores (specify --details for more information):\n")
return
}
if details {
d.Printf("%s Restores:\n", uploaderType)
} else {
d.Printf("%s Restores (specify --details for more information):\n", uploaderType)
}
// separate restores by phase (combining <none> and New into a single group)