From 07137454c19cc8e2aac24d795ccdbea6ffa2b2f5 Mon Sep 17 00:00:00 2001 From: Nitin Goyal Date: Fri, 1 Apr 2022 17:26:20 +0530 Subject: [PATCH] fix: fix ensureDeleted of openshiftSccs via returning an error The func does not return an error if there is an error and always return nil. Fix the same via returning and error if there non-expected failure. Signed-off-by: Nitin Goyal --- controllers/scc.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/controllers/scc.go b/controllers/scc.go index 0a6cb09a4..fcd2de893 100644 --- a/controllers/scc.go +++ b/controllers/scc.go @@ -73,12 +73,11 @@ func (c openshiftSccs) ensureDeleted(r *LVMClusterReconciler, ctx context.Contex for _, scc := range sccs { err = r.SecurityClient.SecurityContextConstraints().Delete(ctx, scc.Name, metav1.DeleteOptions{}) if err != nil { - if errors.IsNotFound(err) { - r.Log.Info("SecurityContextConstraint is already deleted", "SecurityContextConstraint", scc.Name) - return nil - } else { + if !errors.IsNotFound(err) { r.Log.Error(err, "failed to delete SecurityContextConstraint", "SecurityContextConstraint", scc.Name) + return err } + r.Log.Info("SecurityContextConstraint is already deleted", "SecurityContextConstraint", scc.Name) } } }