diff --git a/controllers/drupalsite_controller.go b/controllers/drupalsite_controller.go index b97ffea5a4de5931d5a02fb744292f1353482f48..77f9dabd4fc669fa6b9edad01b0a2e0494fa652b 100644 --- a/controllers/drupalsite_controller.go +++ b/controllers/drupalsite_controller.go @@ -259,7 +259,7 @@ func (r *DrupalSiteReconciler) Reconcile(ctx context.Context, req ctrl.Request) // Set Current version if drupalSite.Status.ReleaseID.Current != releaseID(drupalSite) { drupalSite.Status.ReleaseID.Current = releaseID(drupalSite) - update = true || update + update = true } // Check if the drupal site is ready to serve requests diff --git a/controllers/drupalsite_controller_utils.go b/controllers/drupalsite_controller_utils.go index 94118d4f536998189162923f0780381983a6498d..87b6185e5ad36d399b15799733b38502348fad01 100644 --- a/controllers/drupalsite_controller_utils.go +++ b/controllers/drupalsite_controller_utils.go @@ -178,16 +178,16 @@ func (r *DrupalSiteReconciler) ensureSpecFinalizer(ctx context.Context, drp *web if !controllerutil.ContainsFinalizer(drp, finalizerStr) { log.V(3).Info("Adding finalizer") controllerutil.AddFinalizer(drp, finalizerStr) - update = true || update + update = true } if drp.Spec.Configuration.WebDAVPassword == "" { drp.Spec.Configuration.WebDAVPassword = generateRandomPassword() - update = true || update + update = true } // Set default value for DiskSize to 2000Mi if drp.Spec.Configuration.CloneFrom == "" && drp.Spec.Configuration.DiskSize == "" { drp.Spec.Configuration.DiskSize = "2000Mi" - update = true || update + update = true } // Validate that CloneFrom is an existing DrupalSite if drp.Spec.Configuration.CloneFrom != "" { @@ -195,9 +195,9 @@ func (r *DrupalSiteReconciler) ensureSpecFinalizer(ctx context.Context, drp *web err := r.Get(ctx, types.NamespacedName{Name: string(drp.Spec.Configuration.CloneFrom), Namespace: drp.Namespace}, &sourceSite) switch { case k8sapierrors.IsNotFound(err): - return update, newApplicationError(fmt.Errorf("CloneFrom DrupalSite doesn't exist"), ErrInvalidSpec) + return false, newApplicationError(fmt.Errorf("CloneFrom DrupalSite doesn't exist"), ErrInvalidSpec) case err != nil: - return update, newApplicationError(err, ErrClientK8s) + return false, newApplicationError(err, ErrClientK8s) } // The destination disk size must be at least as large as the source if drp.Spec.Configuration.DiskSize < sourceSite.Spec.Configuration.DiskSize { @@ -213,7 +213,6 @@ func (r *DrupalSiteReconciler) ensureSpecFinalizer(ctx context.Context, drp *web drp.Spec.Configuration.ExtraConfigurationRepository.Branch = sourceSite.Spec.Configuration.ExtraConfigurationRepository.Branch drp.Spec.Configuration.ExtraConfigurationRepository.RepositoryUrl = sourceSite.Spec.Configuration.ExtraConfigurationRepository.RepositoryUrl } - update = true || update } // Initialize 'spec.version.releaseSpec' if empty if len(drp.Spec.Version.ReleaseSpec) == 0 { @@ -237,7 +236,7 @@ func (r *DrupalSiteReconciler) ensureSpecFinalizer(ctx context.Context, drp *web for _, v := range supportedDrupalVersions.Status.AvailableVersions { if drp.Spec.Name == v.Name { drp.Spec.Version.ReleaseSpec = v.LatestReleaseSpec - update = true || update + update = true break } }