Skip to content

Commit

Permalink
fix: fix ensureDeleted of openshiftSccs via returning an error
Browse files Browse the repository at this point in the history
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 <nigoyal@redhat.com>
  • Loading branch information
iamniting committed Apr 4, 2022
1 parent 009cdf4 commit 0713745
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions controllers/scc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down

0 comments on commit 0713745

Please sign in to comment.