Skip to content

Commit 637d5f3

Browse files
committed
fixed panic in describe output while displaying Hooksattempted or failed count
1 parent b4d6566 commit 637d5f3

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

cmd/non-admin/backup/describe.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,13 @@ func printNonAdminBackupDetails(cmd *cobra.Command, nab *nacv1alpha1.NonAdminBac
372372
fmt.Fprintf(out, "\n")
373373

374374
// Hooks
375-
fmt.Fprintf(out, "HooksAttempted: %d\n", status.HookStatus.HooksAttempted)
376-
fmt.Fprintf(out, "HooksFailed: %d\n", status.HookStatus.HooksFailed)
375+
if status.HookStatus != nil {
376+
fmt.Fprintf(out, "HooksAttempted: %d\n", status.HookStatus.HooksAttempted)
377+
fmt.Fprintf(out, "HooksFailed: %d\n", status.HookStatus.HooksFailed)
378+
} else {
379+
fmt.Fprintf(out, "HooksAttempted: <none>\n")
380+
fmt.Fprintf(out, "HooksFailed: <none>\n")
381+
}
377382
} else {
378383
// Velero backup not available yet
379384
fmt.Fprintf(out, "Velero backup information not yet available.\n")

cmd/non-admin/restore/describe.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,13 @@ func printNonAdminRestoreDetails(cmd *cobra.Command, nar *nacv1alpha1.NonAdminRe
317317
fmt.Fprintf(out, "\n")
318318

319319
// Hooks
320-
fmt.Fprintf(out, "HooksAttempted: %d\n", status.HookStatus.HooksAttempted)
321-
fmt.Fprintf(out, "HooksFailed: %d\n", status.HookStatus.HooksFailed)
320+
if status.HookStatus != nil {
321+
fmt.Fprintf(out, "HooksAttempted: %d\n", status.HookStatus.HooksAttempted)
322+
fmt.Fprintf(out, "HooksFailed: %d\n", status.HookStatus.HooksFailed)
323+
} else {
324+
fmt.Fprintf(out, "HooksAttempted: <none>\n")
325+
fmt.Fprintf(out, "HooksFailed: <none>\n")
326+
}
322327
} else {
323328
// Velero restore not available yet
324329
fmt.Fprintf(out, "Velero restore information not yet available.\n")

0 commit comments

Comments
 (0)