Skip to content

Commit 3fc7ef9

Browse files
committed
Address Tim's comments
1 parent 8887105 commit 3fc7ef9

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

pkg/controller/operators/olm/operator.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,18 +1422,17 @@ func (a *Operator) syncCopyCSV(obj interface{}) (syncError error) {
14221422
// without an error.
14231423
func (a *Operator) copiedCSVsAreEnabled() (bool, error) {
14241424
olmConfig, err := a.client.OperatorsV1().OLMConfigs().Get(context.TODO(), "cluster", metav1.GetOptions{})
1425-
// If there was an error that wasn't an IsNotFound, return the error
1426-
if err != nil && !k8serrors.IsNotFound(err) {
1425+
if err != nil {
1426+
// Default to true if olmConfig singleton cannot be found
1427+
if k8serrors.IsNotFound(err) {
1428+
return true, nil
1429+
}
1430+
// If there was an error that wasn't an IsNotFound, return the error
14271431
return false, err
14281432
}
14291433

1430-
// If there was no error, return value based on olmConfig ingleton
1431-
if err == nil {
1432-
return olmConfig.CopiedCSVsAreEnabled(), nil
1433-
}
1434-
1435-
// Default to true if olmConfig cannot be found
1436-
return true, nil
1434+
// If there was no error, return value based on olmConfig singleton
1435+
return olmConfig.CopiedCSVsAreEnabled(), nil
14371436
}
14381437

14391438
func (a *Operator) getCopiedCSVDisabledEventsForCSV(csv *v1alpha1.ClusterServiceVersion) ([]corev1.Event, error) {

0 commit comments

Comments
 (0)