core: always return nil on error
We should always return a nil pointer of clusterInfo if
CreateOrLoadClusterInfo() returns an error.
Closes: https://github.com/rook/rook/issues/9314
Signed-off-by: Sébastien Han <seb@redhat.com>
(cherry picked from commit fdd243d3de)
This commit is contained in:
1 parent
f0e19ea309
commit
60fb7f0ae9
1 file changed
+2
-2
@@ -155,7 +155,7 @@ 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"])
|
||||
@@ -163,7 +163,7 @@ func CreateOrLoadClusterInfo(clusterdContext *clusterd.Context, context context.
|
||||
}
|
||||
|
||||
if err := ValidateCephCSIConnectionSecrets(clusterdContext, namespace); err != nil {
|
||||
return clusterInfo, maxMonID, monMapping, err
|
||||
return nil, maxMonID, monMapping, err
|
||||
}
|
||||
|
||||
return clusterInfo, maxMonID, monMapping, nil
|
||||
|
||||
Reference in new issue
Block a user