Skip to content

Commit

Permalink
core: always return nil on error
Browse files Browse the repository at this point in the history
We should always return a nil pointer of clusterInfo if
CreateOrLoadClusterInfo() returns an error.

Closes: #9314
Signed-off-by: Sébastien Han <seb@redhat.com>
  • Loading branch information
leseb committed Dec 8, 2021
1 parent 634be7d commit b45887f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/operator/ceph/cluster/mon/config.go
Expand Up @@ -155,15 +155,15 @@ func CreateOrLoadClusterInfo(clusterdContext *clusterd.Context, context context.
if clusterInfo.CephCred.Secret == adminSecretNameKey {
secret, err := clusterdContext.Clientset.CoreV1().Secrets(namespace).Get(context, OperatorCreds, metav1.GetOptions{})
if err != nil {
return clusterInfo, maxMonID, monMapping, err
return nil, maxMonID, monMapping, err
}
// Populate external credential
clusterInfo.CephCred.Username = string(secret.Data["userID"])
clusterInfo.CephCred.Secret = string(secret.Data["userKey"])
}

if err := ValidateCephCSIConnectionSecrets(clusterdContext, namespace); err != nil {
return clusterInfo, maxMonID, monMapping, err
return nil, maxMonID, monMapping, err
}

return clusterInfo, maxMonID, monMapping, nil
Expand Down

0 comments on commit b45887f

Please sign in to comment.