Skip to content

Commit

Permalink
provider: don't re-use 'err' variable in job creation
Browse files Browse the repository at this point in the history
Signed-off-by: Jose A. Rivera <[email protected]>
  • Loading branch information
jarrpa committed Mar 8, 2024
1 parent 49681da commit e6e778b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions controllers/storagecluster/provider_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,9 +496,12 @@ func (o *ocsProviderServer) createJob(r *StorageClusterReconciler, instance *ocs

if errors.IsNotFound(err) {
onboardingSecretGeneratorJob := getOnboardingJobObject(instance)
err = r.Client.Create(context.Background(), onboardingSecretGeneratorJob)
}
if err != nil {
jobErr := r.Client.Create(context.Background(), onboardingSecretGeneratorJob)
if jobErr != nil && !errors.IsAlreadyExists(jobErr) {
r.Log.Error(jobErr, "failed to create onboarding job")
return reconcile.Result{}, jobErr
}
} else if err != nil {
r.Log.Error(err, "failed to create/ensure secret")
return reconcile.Result{}, err
}
Expand Down

0 comments on commit e6e778b

Please sign in to comment.