Skip to content

Commit

Permalink
chore: add log context when nsa update fails (#1104)
Browse files Browse the repository at this point in the history
Signed-off-by: chenk <hen.keinan@gmail.com>
  • Loading branch information
chen-keinan authored Apr 4, 2022
1 parent 45acabb commit 1c26090
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion pkg/compliance/clustercompliancereport.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ func (r *ClusterComplianceReportReconciler) generateComplianceReport(ctx context
return fmt.Errorf("failed to check report cron expression %w", err)
}
if utils.DurationExceeded(durationToNextGeneration) {
return r.Mgr.GenerateComplianceReport(ctx, report.Spec)
err = r.Mgr.GenerateComplianceReport(ctx, report.Spec)
if err != nil {
log.Error(err, "failed to generate compliance report")
}
return err
}
log.V(1).Info("RequeueAfter", "durationToNextGeneration", durationToNextGeneration)
ctrlResult.RequeueAfter = durationToNextGeneration
Expand Down
2 changes: 1 addition & 1 deletion pkg/compliance/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (w *cm) GenerateComplianceReport(ctx context.Context, spec v1alpha1.ReportS
//create cluster compliance details report
err = w.createComplianceDetailReport(ctx, spec, smd, checkIdsToResults, st)
if err != nil {
return err
return fmt.Errorf("failed to create compliance detail report name: %s with error %w", strings.ToLower(fmt.Sprintf("%s-%s", spec.Name, "details")), err)
}
//generate cluster compliance report
updatedReport, err := w.createComplianceReport(ctx, spec, st, controlChecks)
Expand Down

0 comments on commit 1c26090

Please sign in to comment.