Skip to content

Commit d4b809a

Browse files
committed
fixup printf findings
1 parent 74993b3 commit d4b809a

17 files changed

+36
-39
lines changed

.golangci.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,6 @@ linters:
315315
- staticcheck
316316
path: ^(apis/(v1alpha3|v1alpha4)\/.*)\.go$
317317
text: ST1021|ST1020
318-
# Ignore non-constant format string in call to condition utils
319-
- linters:
320-
- govet
321-
text: non-constant format string in call to sigs\.k8s\.io\/cluster-api\/util\/conditions\.
322318
- linters:
323319
- goconst
324320
path: (.+)_test\.go

controllers/clustermodule_reconciler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ func (r Reconciler) Reconcile(ctx context.Context, clusterCtx *capvcontext.Clust
177177
err = errors.New(generateClusterModuleErrorMessage(modErrs))
178178
}
179179
deprecatedconditions.MarkFalse(clusterCtx.VSphereCluster, infrav1.ClusterModulesAvailableCondition, infrav1.ClusterModuleSetupFailedReason,
180-
clusterv1beta1.ConditionSeverityWarning, generateClusterModuleErrorMessage(modErrs))
180+
clusterv1beta1.ConditionSeverityWarning, "%s", generateClusterModuleErrorMessage(modErrs))
181181
deprecatedv1beta2conditions.Set(clusterCtx.VSphereCluster, metav1.Condition{
182182
Type: infrav1.VSphereClusterClusterModulesReadyV1Beta2Condition,
183183
Status: metav1.ConditionFalse,

controllers/vmware/serviceaccount_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ func (r *ServiceAccountReconciler) reconcileNormal(ctx context.Context, guestClu
208208
defer func() {
209209
if reterr != nil {
210210
deprecatedconditions.MarkFalse(guestClusterCtx.VSphereCluster, vmwarev1.ProviderServiceAccountsReadyCondition, vmwarev1.ProviderServiceAccountsReconciliationFailedReason,
211-
clusterv1beta1.ConditionSeverityWarning, reterr.Error())
211+
clusterv1beta1.ConditionSeverityWarning, "%v", reterr)
212212
deprecatedv1beta2conditions.Set(guestClusterCtx.VSphereCluster, metav1.Condition{
213213
Type: vmwarev1.VSphereClusterProviderServiceAccountsReadyV1Beta2Condition,
214214
Status: metav1.ConditionFalse,

controllers/vmware/servicediscovery_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ func (r *serviceDiscoveryReconciler) patch(ctx context.Context, clusterCtx *vmwa
239239
func (r *serviceDiscoveryReconciler) reconcileNormal(ctx context.Context, guestClusterCtx *vmwarecontext.GuestClusterContext) error {
240240
if err := r.reconcileSupervisorHeadlessService(ctx, guestClusterCtx); err != nil {
241241
deprecatedconditions.MarkFalse(guestClusterCtx.VSphereCluster, vmwarev1.ServiceDiscoveryReadyCondition, vmwarev1.SupervisorHeadlessServiceSetupFailedReason,
242-
clusterv1beta1.ConditionSeverityWarning, err.Error())
242+
clusterv1beta1.ConditionSeverityWarning, "%v", err)
243243
deprecatedv1beta2conditions.Set(guestClusterCtx.VSphereCluster, metav1.Condition{
244244
Type: vmwarev1.VSphereClusterServiceDiscoveryReadyV1Beta2Condition,
245245
Status: metav1.ConditionFalse,
@@ -283,7 +283,7 @@ func (r *serviceDiscoveryReconciler) reconcileSupervisorHeadlessService(ctx cont
283283
// Note: We have watches on the LB Svc (VIP) & the cluster-info configmap (FIP).
284284
// There is no need to return an error to keep re-trying.
285285
deprecatedconditions.MarkFalse(guestClusterCtx.VSphereCluster, vmwarev1.ServiceDiscoveryReadyCondition, vmwarev1.SupervisorHeadlessServiceSetupFailedReason,
286-
clusterv1beta1.ConditionSeverityWarning, err.Error())
286+
clusterv1beta1.ConditionSeverityWarning, "%v", err)
287287
deprecatedv1beta2conditions.Set(guestClusterCtx.VSphereCluster, metav1.Condition{
288288
Type: vmwarev1.VSphereClusterServiceDiscoveryReadyV1Beta2Condition,
289289
Status: metav1.ConditionFalse,

controllers/vmware/vspherecluster_reconciler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ func (r *ClusterReconciler) reconcileNormal(ctx context.Context, clusterCtx *vmw
245245
// Reconciling the ResourcePolicy early potentially saves us the extra relocate operation.
246246
resourcePolicyName, err := r.ResourcePolicyService.ReconcileResourcePolicy(ctx, clusterCtx)
247247
if err != nil {
248-
deprecatedconditions.MarkFalse(clusterCtx.VSphereCluster, vmwarev1.ResourcePolicyReadyCondition, vmwarev1.ResourcePolicyCreationFailedReason, clusterv1beta1.ConditionSeverityWarning, err.Error())
248+
deprecatedconditions.MarkFalse(clusterCtx.VSphereCluster, vmwarev1.ResourcePolicyReadyCondition, vmwarev1.ResourcePolicyCreationFailedReason, clusterv1beta1.ConditionSeverityWarning, "%v", err)
249249
deprecatedv1beta2conditions.Set(clusterCtx.VSphereCluster, metav1.Condition{
250250
Type: vmwarev1.VSphereClusterResourcePolicyReadyV1Beta2Condition,
251251
Status: metav1.ConditionFalse,

controllers/vspherecluster_reconciler.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ func (r *clusterReconciler) reconcileNormal(ctx context.Context, clusterCtx *cap
273273

274274
// Reconcile vCenter availability.
275275
if err := r.reconcileIdentitySecret(ctx, clusterCtx); err != nil {
276-
deprecatedconditions.MarkFalse(clusterCtx.VSphereCluster, infrav1.VCenterAvailableCondition, infrav1.VCenterUnreachableReason, clusterv1beta1.ConditionSeverityError, err.Error())
276+
deprecatedconditions.MarkFalse(clusterCtx.VSphereCluster, infrav1.VCenterAvailableCondition, infrav1.VCenterUnreachableReason, clusterv1beta1.ConditionSeverityError, "%v", err)
277277
deprecatedv1beta2conditions.Set(clusterCtx.VSphereCluster, metav1.Condition{
278278
Type: infrav1.VSphereClusterVCenterAvailableV1Beta2Condition,
279279
Status: metav1.ConditionFalse,
@@ -285,7 +285,7 @@ func (r *clusterReconciler) reconcileNormal(ctx context.Context, clusterCtx *cap
285285

286286
vcenterSession, err := r.reconcileVCenterConnectivity(ctx, clusterCtx)
287287
if err != nil {
288-
deprecatedconditions.MarkFalse(clusterCtx.VSphereCluster, infrav1.VCenterAvailableCondition, infrav1.VCenterUnreachableReason, clusterv1beta1.ConditionSeverityError, err.Error())
288+
deprecatedconditions.MarkFalse(clusterCtx.VSphereCluster, infrav1.VCenterAvailableCondition, infrav1.VCenterUnreachableReason, clusterv1beta1.ConditionSeverityError, "%v", err)
289289
deprecatedv1beta2conditions.Set(clusterCtx.VSphereCluster, metav1.Condition{
290290
Type: infrav1.VSphereClusterVCenterAvailableV1Beta2Condition,
291291
Status: metav1.ConditionFalse,
@@ -305,7 +305,7 @@ func (r *clusterReconciler) reconcileNormal(ctx context.Context, clusterCtx *cap
305305
// Reconcile cluster modules.
306306
err = r.reconcileVCenterVersion(clusterCtx, vcenterSession)
307307
if err != nil || clusterCtx.VSphereCluster.Status.VCenterVersion == "" {
308-
deprecatedconditions.MarkFalse(clusterCtx.VSphereCluster, infrav1.ClusterModulesAvailableCondition, infrav1.MissingVCenterVersionReason, clusterv1beta1.ConditionSeverityWarning, err.Error())
308+
deprecatedconditions.MarkFalse(clusterCtx.VSphereCluster, infrav1.ClusterModulesAvailableCondition, infrav1.MissingVCenterVersionReason, clusterv1beta1.ConditionSeverityWarning, "%v", err)
309309
deprecatedv1beta2conditions.Set(clusterCtx.VSphereCluster, metav1.Condition{
310310
Type: infrav1.VSphereClusterClusterModulesReadyV1Beta2Condition,
311311
Status: metav1.ConditionFalse,
@@ -317,7 +317,7 @@ func (r *clusterReconciler) reconcileNormal(ctx context.Context, clusterCtx *cap
317317

318318
affinityReconcileResult, err := r.reconcileClusterModules(ctx, clusterCtx)
319319
if err != nil {
320-
deprecatedconditions.MarkFalse(clusterCtx.VSphereCluster, infrav1.ClusterModulesAvailableCondition, infrav1.ClusterModuleSetupFailedReason, clusterv1beta1.ConditionSeverityWarning, err.Error())
320+
deprecatedconditions.MarkFalse(clusterCtx.VSphereCluster, infrav1.ClusterModulesAvailableCondition, infrav1.ClusterModuleSetupFailedReason, clusterv1beta1.ConditionSeverityWarning, "%v", err)
321321
deprecatedv1beta2conditions.Set(clusterCtx.VSphereCluster, metav1.Condition{
322322
Type: infrav1.VSphereClusterClusterModulesReadyV1Beta2Condition,
323323
Status: metav1.ConditionFalse,

controllers/vsphereclusteridentity_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func (r clusterIdentityReconciler) Reconcile(ctx context.Context, req reconcile.
120120
Name: identity.Spec.SecretName,
121121
}
122122
if err := r.Client.Get(ctx, secretKey, secret); err != nil {
123-
deprecatedconditions.MarkFalse(identity, infrav1.CredentialsAvailableCondidtion, infrav1.SecretNotAvailableReason, clusterv1beta1.ConditionSeverityWarning, err.Error())
123+
deprecatedconditions.MarkFalse(identity, infrav1.CredentialsAvailableCondidtion, infrav1.SecretNotAvailableReason, clusterv1beta1.ConditionSeverityWarning, "%v", err)
124124
deprecatedv1beta2conditions.Set(identity, metav1.Condition{
125125
Type: infrav1.VSphereClusterIdentityAvailableV1Beta2Condition,
126126
Status: metav1.ConditionFalse,
@@ -158,7 +158,7 @@ func (r clusterIdentityReconciler) Reconcile(ctx context.Context, req reconcile.
158158
}
159159
err = r.Client.Update(ctx, secret)
160160
if err != nil {
161-
deprecatedconditions.MarkFalse(identity, infrav1.CredentialsAvailableCondidtion, infrav1.SecretOwnerReferenceFailedReason, clusterv1beta1.ConditionSeverityWarning, err.Error())
161+
deprecatedconditions.MarkFalse(identity, infrav1.CredentialsAvailableCondidtion, infrav1.SecretOwnerReferenceFailedReason, clusterv1beta1.ConditionSeverityWarning, "%v", err)
162162
deprecatedv1beta2conditions.Set(identity, metav1.Condition{
163163
Type: infrav1.VSphereClusterIdentityAvailableV1Beta2Condition,
164164
Status: metav1.ConditionFalse,

controllers/vspheredeploymentzone_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ func (r vsphereDeploymentZoneReconciler) reconcileNormal(ctx context.Context, de
187187

188188
authSession, err := r.getVCenterSession(ctx, deploymentZoneCtx, failureDomain.Spec.Topology.Datacenter)
189189
if err != nil {
190-
deprecatedconditions.MarkFalse(deploymentZoneCtx.VSphereDeploymentZone, infrav1.VCenterAvailableCondition, infrav1.VCenterUnreachableReason, clusterv1beta1.ConditionSeverityError, err.Error())
190+
deprecatedconditions.MarkFalse(deploymentZoneCtx.VSphereDeploymentZone, infrav1.VCenterAvailableCondition, infrav1.VCenterUnreachableReason, clusterv1beta1.ConditionSeverityError, "%v", err)
191191
deprecatedv1beta2conditions.Set(deploymentZoneCtx.VSphereDeploymentZone, metav1.Condition{
192192
Type: infrav1.VSphereDeploymentZoneVCenterAvailableV1Beta2Condition,
193193
Status: metav1.ConditionFalse,

controllers/vspheredeploymentzone_controller_domain.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import (
3939
func (r vsphereDeploymentZoneReconciler) reconcileFailureDomain(ctx context.Context, deploymentZoneCtx *capvcontext.VSphereDeploymentZoneContext, vsphereFailureDomain *infrav1.VSphereFailureDomain) error {
4040
// verify the failure domain for the region
4141
if err := r.reconcileInfraFailureDomain(ctx, deploymentZoneCtx, vsphereFailureDomain, vsphereFailureDomain.Spec.Region); err != nil {
42-
deprecatedconditions.MarkFalse(deploymentZoneCtx.VSphereDeploymentZone, infrav1.VSphereFailureDomainValidatedCondition, infrav1.RegionMisconfiguredReason, clusterv1beta1.ConditionSeverityError, err.Error())
42+
deprecatedconditions.MarkFalse(deploymentZoneCtx.VSphereDeploymentZone, infrav1.VSphereFailureDomainValidatedCondition, infrav1.RegionMisconfiguredReason, clusterv1beta1.ConditionSeverityError, "%v", err)
4343
deprecatedv1beta2conditions.Set(deploymentZoneCtx.VSphereDeploymentZone, metav1.Condition{
4444
Type: infrav1.VSphereDeploymentZoneFailureDomainValidatedV1Beta2Condition,
4545
Status: metav1.ConditionFalse,
@@ -51,7 +51,7 @@ func (r vsphereDeploymentZoneReconciler) reconcileFailureDomain(ctx context.Cont
5151

5252
// verify the failure domain for the zone
5353
if err := r.reconcileInfraFailureDomain(ctx, deploymentZoneCtx, vsphereFailureDomain, vsphereFailureDomain.Spec.Zone); err != nil {
54-
deprecatedconditions.MarkFalse(deploymentZoneCtx.VSphereDeploymentZone, infrav1.VSphereFailureDomainValidatedCondition, infrav1.ZoneMisconfiguredReason, clusterv1beta1.ConditionSeverityError, err.Error())
54+
deprecatedconditions.MarkFalse(deploymentZoneCtx.VSphereDeploymentZone, infrav1.VSphereFailureDomainValidatedCondition, infrav1.ZoneMisconfiguredReason, clusterv1beta1.ConditionSeverityError, "%v", err)
5555
deprecatedv1beta2conditions.Set(deploymentZoneCtx.VSphereDeploymentZone, metav1.Condition{
5656
Type: infrav1.VSphereDeploymentZoneFailureDomainValidatedV1Beta2Condition,
5757
Status: metav1.ConditionFalse,

controllers/vspherevm_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ func (r vmReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.R
173173

174174
authSession, err := r.retrieveVcenterSession(ctx, vsphereVM)
175175
if err != nil {
176-
deprecatedconditions.MarkFalse(vsphereVM, infrav1.VCenterAvailableCondition, infrav1.VCenterUnreachableReason, clusterv1beta1.ConditionSeverityError, err.Error())
176+
deprecatedconditions.MarkFalse(vsphereVM, infrav1.VCenterAvailableCondition, infrav1.VCenterUnreachableReason, clusterv1beta1.ConditionSeverityError, "%v", err)
177177
deprecatedv1beta2conditions.Set(vsphereVM, metav1.Condition{
178178
Type: infrav1.VSphereVMVCenterAvailableV1Beta2Condition,
179179
Status: metav1.ConditionFalse,
@@ -385,7 +385,7 @@ func (r vmReconciler) reconcileDelete(ctx context.Context, vmCtx *capvcontext.VM
385385
})
386386
result, vm, err := r.VMService.DestroyVM(ctx, vmCtx)
387387
if err != nil {
388-
deprecatedconditions.MarkFalse(vmCtx.VSphereVM, infrav1.VMProvisionedCondition, "DeletionFailed", clusterv1beta1.ConditionSeverityWarning, err.Error())
388+
deprecatedconditions.MarkFalse(vmCtx.VSphereVM, infrav1.VMProvisionedCondition, "DeletionFailed", clusterv1beta1.ConditionSeverityWarning, "%v", err)
389389
deprecatedv1beta2conditions.Set(vmCtx.VSphereVM, metav1.Condition{
390390
Type: infrav1.VSphereVMVirtualMachineProvisionedV1Beta2Condition,
391391
Status: metav1.ConditionFalse,

0 commit comments

Comments
 (0)