Skip to content

Commit edf68c8

Browse files
committed
Address Tim's comments
1 parent 5c93c20 commit edf68c8

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
@@ -1421,18 +1421,17 @@ func (a *Operator) syncCopyCSV(obj interface{}) (syncError error) {
14211421
// without an error.
14221422
func (a *Operator) copiedCSVsAreEnabled() (bool, error) {
14231423
olmConfig, err := a.client.OperatorsV1().OLMConfigs().Get(context.TODO(), "cluster", metav1.GetOptions{})
1424-
// If there was an error that wasn't an IsNotFound, return the error
1425-
if err != nil && !k8serrors.IsNotFound(err) {
1424+
if err != nil {
1425+
// Default to true if olmConfig singleton cannot be found
1426+
if k8serrors.IsNotFound(err) {
1427+
return true, nil
1428+
}
1429+
// If there was an error that wasn't an IsNotFound, return the error
14261430
return false, err
14271431
}
14281432

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

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

0 commit comments

Comments
 (0)