@@ -128,7 +128,7 @@ func (r ReplicaSetReconciler) Reconcile(ctx context.Context, request reconcile.R
128128 r .log .Infof ("Reconciling MongoDB" )
129129
130130 r .log .Debug ("Validating MongoDB.Spec" )
131- err , lastAppliedSpec := r .validateSpec (mdb )
131+ lastAppliedSpec , err := r .validateSpec (mdb )
132132 if err != nil {
133133 return status .Update (ctx , r .client .Status (), & mdb , statusOptions ().
134134 withMessage (Error , fmt .Sprintf ("error validating new Spec: %s" , err )).
@@ -596,20 +596,20 @@ func (r *ReplicaSetReconciler) buildService(mdb mdbv1.MongoDBCommunity, portMana
596596// If there has not yet been a successful configuration, the function runs the initial Spec validations. Otherwise,
597597// it checks that the attempted Spec is valid in relation to the Spec that resulted from that last successful configuration.
598598// 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 ) {
600600 lastSuccessfulConfigurationSaved , ok := mdb .Annotations [lastSuccessfulConfiguration ]
601601 if ! ok {
602602 // First version of Spec
603- return validation .ValidateInitialSpec (mdb , r .log ), nil
603+ return nil , validation .ValidateInitialSpec (mdb , r .log )
604604 }
605605
606606 lastSpec := mdbv1.MongoDBCommunitySpec {}
607607 err := json .Unmarshal ([]byte (lastSuccessfulConfigurationSaved ), & lastSpec )
608608 if err != nil {
609- return err , & lastSpec
609+ return & lastSpec , err
610610 }
611611
612- return validation .ValidateUpdate (mdb , lastSpec , r .log ), & lastSpec
612+ return & lastSpec , validation .ValidateUpdate (mdb , lastSpec , r .log )
613613}
614614
615615func getCustomRolesModification (mdb mdbv1.MongoDBCommunity ) (automationconfig.Modification , error ) {
0 commit comments