Skip to content

Commit

Permalink
bug fix: don't panic on nil restic repo maintenance time (#2315)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
nrb authored Mar 5, 2020
1 parent bdb9145 commit fd95a59
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/2315-skriss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bug fix: don't panic in `velero restic repo get` when last maintenance time is `nil`
6 changes: 4 additions & 2 deletions pkg/cmd/util/output/restic_repo_printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit fd95a59

Please sign in to comment.