@@ -128,7 +128,7 @@ func (r ReplicaSetReconciler) Reconcile(ctx context.Context, request reconcile.R
128
128
r .log .Infof ("Reconciling MongoDB" )
129
129
130
130
r .log .Debug ("Validating MongoDB.Spec" )
131
- err , lastAppliedSpec := r .validateSpec (mdb )
131
+ lastAppliedSpec , err := r .validateSpec (mdb )
132
132
if err != nil {
133
133
return status .Update (ctx , r .client .Status (), & mdb , statusOptions ().
134
134
withMessage (Error , fmt .Sprintf ("error validating new Spec: %s" , err )).
@@ -596,20 +596,20 @@ func (r *ReplicaSetReconciler) buildService(mdb mdbv1.MongoDBCommunity, portMana
596
596
// If there has not yet been a successful configuration, the function runs the initial Spec validations. Otherwise,
597
597
// it checks that the attempted Spec is valid in relation to the Spec that resulted from that last successful configuration.
598
598
// The validation also returns the lastSuccessFulConfiguration Spec as mdbv1.MongoDBCommunitySpec.
599
- func (r ReplicaSetReconciler ) validateSpec (mdb mdbv1.MongoDBCommunity ) (error , * mdbv1.MongoDBCommunitySpec ) {
599
+ func (r ReplicaSetReconciler ) validateSpec (mdb mdbv1.MongoDBCommunity ) (* mdbv1.MongoDBCommunitySpec , error ) {
600
600
lastSuccessfulConfigurationSaved , ok := mdb .Annotations [lastSuccessfulConfiguration ]
601
601
if ! ok {
602
602
// First version of Spec
603
- return validation .ValidateInitialSpec (mdb , r .log ), nil
603
+ return nil , validation .ValidateInitialSpec (mdb , r .log )
604
604
}
605
605
606
606
lastSpec := mdbv1.MongoDBCommunitySpec {}
607
607
err := json .Unmarshal ([]byte (lastSuccessfulConfigurationSaved ), & lastSpec )
608
608
if err != nil {
609
- return err , & lastSpec
609
+ return & lastSpec , err
610
610
}
611
611
612
- return validation .ValidateUpdate (mdb , lastSpec , r .log ), & lastSpec
612
+ return & lastSpec , validation .ValidateUpdate (mdb , lastSpec , r .log )
613
613
}
614
614
615
615
func getCustomRolesModification (mdb mdbv1.MongoDBCommunity ) (automationconfig.Modification , error ) {
0 commit comments