Skip to content

Commit

Permalink
Merge pull request #229 from makkes/fix-logging
Browse files Browse the repository at this point in the history
fix: log messages contain '%s'
  • Loading branch information
hiddeco committed Mar 3, 2021
2 parents f1d3bc9 + 199636f commit 3e79a5c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions controllers/helmrelease_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,8 @@ func (r *HelmReleaseReconciler) composeValues(ctx context.Context, hr v2.HelmRel
if err := r.Get(ctx, namespacedName, resource); err != nil {
if apierrors.IsNotFound(err) {
if v.Optional {
(logr.FromContext(ctx)).Info("could not find optional %s '%s'", v.Kind, namespacedName)
(logr.FromContext(ctx)).
Info(fmt.Sprintf("could not find optional %s '%s'", v.Kind, namespacedName))
continue
}
return nil, fmt.Errorf("could not find %s '%s'", v.Kind, namespacedName)
Expand All @@ -551,7 +552,7 @@ func (r *HelmReleaseReconciler) composeValues(ctx context.Context, hr v2.HelmRel
}
if resource == nil {
if v.Optional {
(logr.FromContext(ctx)).Info("could not find optional %s '%s'", v.Kind, namespacedName)
(logr.FromContext(ctx)).Info(fmt.Sprintf("could not find optional %s '%s'", v.Kind, namespacedName))
continue
}
return nil, fmt.Errorf("could not find %s '%s'", v.Kind, namespacedName)
Expand All @@ -572,7 +573,8 @@ func (r *HelmReleaseReconciler) composeValues(ctx context.Context, hr v2.HelmRel
if err := r.Get(ctx, namespacedName, resource); err != nil {
if apierrors.IsNotFound(err) {
if v.Optional {
(logr.FromContext(ctx)).Info("could not find optional %s '%s'", v.Kind, namespacedName)
(logr.FromContext(ctx)).
Info(fmt.Sprintf("could not find optional %s '%s'", v.Kind, namespacedName))
continue
}
return nil, fmt.Errorf("could not find %s '%s'", v.Kind, namespacedName)
Expand All @@ -583,7 +585,7 @@ func (r *HelmReleaseReconciler) composeValues(ctx context.Context, hr v2.HelmRel
}
if resource == nil {
if v.Optional {
(logr.FromContext(ctx)).Info("could not find optional %s '%s'", v.Kind, namespacedName)
(logr.FromContext(ctx)).Info(fmt.Sprintf("could not find optional %s '%s'", v.Kind, namespacedName))
continue
}
return nil, fmt.Errorf("could not find %s '%s'", v.Kind, namespacedName)
Expand Down

0 comments on commit 3e79a5c

Please sign in to comment.