bug fix: don't panic on nil restic repo maintenance time (#2315)

* bug fix: don't panic on nil restic repo maintenance time

Signed-off-by: Steve Kriss <krisss@vmware.com>

* changelog

Signed-off-by: Steve Kriss <krisss@vmware.com>
This commit is contained in:
Nolan Brubaker
2020-03-05 17:11:59 -05:00
committed by Steve Kriss
parent 0665b05321
commit 981e92c3e7
2 changed files with 5 additions and 2 deletions

View File

@@ -0,0 +1 @@
bug fix: don't panic in `velero restic repo get` when last maintenance time is `nil`

View File

@@ -52,9 +52,11 @@ func printResticRepo(repo *v1.ResticRepository) []metav1.TableRow {
status = v1.ResticRepositoryPhaseNew
}
lastMaintenance := repo.Status.LastMaintenanceTime.String()
if repo.Status.LastMaintenanceTime.IsZero() {
var lastMaintenance string
if repo.Status.LastMaintenanceTime == nil || repo.Status.LastMaintenanceTime.IsZero() {
lastMaintenance = "<never>"
} else {
lastMaintenance = repo.Status.LastMaintenanceTime.String()
}
row.Cells = append(row.Cells,