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>
pull/2248/head
Nolan Brubaker 2020-03-05 17:11:59 -05:00 committed by GitHub
parent bdb9145375
commit fd95a59cf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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,