Replace %q in messages with '%s'
Signed-off-by: Hidde Beydals <hello@hidde.co>
This commit is contained in:
parent
e34f79203d
commit
f1de98faf0
|
@ -292,7 +292,7 @@ func (r *GitRepositoryReconciler) reconcileSource(ctx context.Context,
|
|||
})
|
||||
if err != nil {
|
||||
conditions.MarkTrue(obj, sourcev1.CheckoutFailedCondition, sourcev1.AuthenticationFailedReason,
|
||||
"Failed to get auth strategy for Git implementation %q: %s", obj.Spec.GitImplementation, err)
|
||||
"Failed to get auth strategy for Git implementation '%s': %s", obj.Spec.GitImplementation, err)
|
||||
// Do not return error as recovery without changes is impossible
|
||||
return ctrl.Result{}, nil
|
||||
}
|
||||
|
@ -316,9 +316,9 @@ func (r *GitRepositoryReconciler) reconcileSource(ctx context.Context,
|
|||
auth, err = authStrategy.Method(secret)
|
||||
if err != nil {
|
||||
conditions.MarkTrue(obj, sourcev1.CheckoutFailedCondition, sourcev1.AuthenticationFailedReason,
|
||||
"Failed to configure auth strategy for Git implementation %q: %s", obj.Spec.GitImplementation, err)
|
||||
"Failed to configure auth strategy for Git implementation '%s': %s", obj.Spec.GitImplementation, err)
|
||||
r.Eventf(ctx, obj, events.EventSeverityError, sourcev1.AuthenticationFailedReason,
|
||||
"Failed to configure auth strategy for Git implementation %q: %s", obj.Spec.GitImplementation, err)
|
||||
"Failed to configure auth strategy for Git implementation '%s': %s", obj.Spec.GitImplementation, err)
|
||||
// Return error as the contents of the secret may change
|
||||
return ctrl.Result{}, err
|
||||
}
|
||||
|
@ -331,7 +331,7 @@ func (r *GitRepositoryReconciler) reconcileSource(ctx context.Context,
|
|||
})
|
||||
if err != nil {
|
||||
conditions.MarkTrue(obj, sourcev1.CheckoutFailedCondition, sourcev1.GitOperationFailedReason,
|
||||
"Failed to configure checkout strategy for Git implementation %q: %s", obj.Spec.GitImplementation, err)
|
||||
"Failed to configure checkout strategy for Git implementation '%s': %s", obj.Spec.GitImplementation, err)
|
||||
// Do not return err as recovery without changes is impossible
|
||||
return ctrl.Result{}, nil
|
||||
}
|
||||
|
@ -471,7 +471,7 @@ func (r *GitRepositoryReconciler) reconcileInclude(ctx context.Context, obj *sou
|
|||
toPath, err := securejoin.SecureJoin(dir, incl.GetToPath())
|
||||
if err != nil {
|
||||
conditions.MarkTrue(obj, sourcev1.IncludeUnavailableCondition, "IllegalPath",
|
||||
"Path calculation for include %q failed: %s", incl.GitRepositoryRef.Name, err.Error())
|
||||
"Path calculation for include '%s' failed: %s", incl.GitRepositoryRef.Name, err.Error())
|
||||
return ctrl.Result{}, err
|
||||
}
|
||||
|
||||
|
@ -479,23 +479,23 @@ func (r *GitRepositoryReconciler) reconcileInclude(ctx context.Context, obj *sou
|
|||
dep := &sourcev1.GitRepository{}
|
||||
if err := r.Get(ctx, types.NamespacedName{Namespace: obj.Namespace, Name: incl.GitRepositoryRef.Name}, dep); err != nil {
|
||||
conditions.MarkTrue(obj, sourcev1.IncludeUnavailableCondition, "NotFound",
|
||||
"Could not get resource for include %q: %s", incl.GitRepositoryRef.Name, err.Error())
|
||||
"Could not get resource for include '%s': %s", incl.GitRepositoryRef.Name, err.Error())
|
||||
return ctrl.Result{}, err
|
||||
}
|
||||
|
||||
// Confirm include has an artifact
|
||||
if dep.GetArtifact() == nil {
|
||||
conditions.MarkTrue(obj, sourcev1.IncludeUnavailableCondition, "NoArtifact",
|
||||
"No artifact available for include %q", incl.GitRepositoryRef.Name)
|
||||
"No artifact available for include '%s'", incl.GitRepositoryRef.Name)
|
||||
return ctrl.Result{}, nil
|
||||
}
|
||||
|
||||
// Copy artifact (sub)contents to configured directory
|
||||
if err := r.Storage.CopyToPath(dep.GetArtifact(), incl.GetFromPath(), toPath); err != nil {
|
||||
conditions.MarkTrue(obj, sourcev1.IncludeUnavailableCondition, "CopyFailure",
|
||||
"Failed to copy %q include from %s to %s: %s", incl.GitRepositoryRef.Name, incl.GetFromPath(), incl.GetToPath(), err.Error())
|
||||
"Failed to copy '%s' include from %s to %s: %s", incl.GitRepositoryRef.Name, incl.GetFromPath(), incl.GetToPath(), err.Error())
|
||||
r.Eventf(ctx, obj, events.EventSeverityError, sourcev1.IncludeUnavailableCondition,
|
||||
"Failed to copy %q include from %s to %s: %s", incl.GitRepositoryRef.Name, incl.GetFromPath(), incl.GetToPath(), err.Error())
|
||||
"Failed to copy '%s' include from %s to %s: %s", incl.GitRepositoryRef.Name, incl.GetFromPath(), incl.GetToPath(), err.Error())
|
||||
return ctrl.Result{}, err
|
||||
}
|
||||
artifacts[i] = dep.GetArtifact().DeepCopy()
|
||||
|
@ -549,14 +549,14 @@ func (r *GitRepositoryReconciler) verifyCommitSignature(ctx context.Context, obj
|
|||
|
||||
// Verify commit with GPG data from secret
|
||||
if err := commit.Verify(secret); err != nil {
|
||||
conditions.MarkFalse(obj, sourcev1.SourceVerifiedCondition, meta.FailedReason, "Signature verification of commit %q failed: %s", commit.Hash(), err)
|
||||
r.Eventf(ctx, obj, events.EventSeverityError, "InvalidCommitSignature", "Signature verification of commit %q failed: %s", commit.Hash(), err)
|
||||
conditions.MarkFalse(obj, sourcev1.SourceVerifiedCondition, meta.FailedReason, "Signature verification of commit '%s' failed: %s", commit.Hash(), err)
|
||||
r.Eventf(ctx, obj, events.EventSeverityError, "InvalidCommitSignature", "Signature verification of commit '%s' failed: %s", commit.Hash(), err)
|
||||
// Return error in the hope the secret changes
|
||||
return ctrl.Result{}, err
|
||||
}
|
||||
|
||||
conditions.MarkTrue(obj, sourcev1.SourceVerifiedCondition, meta.SucceededReason, "Verified signature of commit %q", commit.Hash())
|
||||
r.Eventf(ctx, obj, events.EventSeverityInfo, "VerifiedCommit", "Verified signature of commit %q", commit.Hash())
|
||||
conditions.MarkTrue(obj, sourcev1.SourceVerifiedCondition, meta.SucceededReason, "Verified signature of commit '%s'", commit.Hash())
|
||||
r.Eventf(ctx, obj, events.EventSeverityInfo, "VerifiedCommit", "Verified signature of commit '%s'", commit.Hash())
|
||||
return ctrl.Result{RequeueAfter: obj.Spec.Interval.Duration}, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -703,7 +703,7 @@ func TestGitRepositoryReconciler_reconcileInclude(t *testing.T) {
|
|||
},
|
||||
wantErr: true,
|
||||
assertConditions: []metav1.Condition{
|
||||
*conditions.TrueCondition(sourcev1.IncludeUnavailableCondition, "NotFound", "Could not get resource for include \"a\": gitrepositories.source.toolkit.fluxcd.io \"a\" not found"),
|
||||
*conditions.TrueCondition(sourcev1.IncludeUnavailableCondition, "NotFound", "Could not get resource for include 'a': gitrepositories.source.toolkit.fluxcd.io \"a\" not found"),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -721,7 +721,7 @@ func TestGitRepositoryReconciler_reconcileInclude(t *testing.T) {
|
|||
{name: "a", toPath: "a/"},
|
||||
},
|
||||
assertConditions: []metav1.Condition{
|
||||
*conditions.TrueCondition(sourcev1.IncludeUnavailableCondition, "NoArtifact", "No artifact available for include \"a\""),
|
||||
*conditions.TrueCondition(sourcev1.IncludeUnavailableCondition, "NoArtifact", "No artifact available for include 'a'"),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -898,7 +898,7 @@ func TestGitRepositoryReconciler_verifyCommitSignature(t *testing.T) {
|
|||
},
|
||||
want: ctrl.Result{RequeueAfter: interval},
|
||||
assertConditions: []metav1.Condition{
|
||||
*conditions.TrueCondition(sourcev1.SourceVerifiedCondition, meta.SucceededReason, "Verified signature of commit \"shasum\""),
|
||||
*conditions.TrueCondition(sourcev1.SourceVerifiedCondition, meta.SucceededReason, "Verified signature of commit 'shasum'"),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -920,7 +920,7 @@ func TestGitRepositoryReconciler_verifyCommitSignature(t *testing.T) {
|
|||
},
|
||||
wantErr: true,
|
||||
assertConditions: []metav1.Condition{
|
||||
*conditions.FalseCondition(sourcev1.SourceVerifiedCondition, meta.FailedReason, "Signature verification of commit \"shasum\" failed: invalid signature"),
|
||||
*conditions.FalseCondition(sourcev1.SourceVerifiedCondition, meta.FailedReason, "Signature verification of commit 'shasum' failed: invalid signature"),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue