Skip to content

Commit c684204

Browse files
committed
address review comments
1 parent 1bf9e34 commit c684204

File tree

1 file changed

+2
-2
lines changed
  • pkg/controller/perconaservermongodb

1 file changed

+2
-2
lines changed

pkg/controller/perconaservermongodb/mgo.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,15 +731,15 @@ func (r *ReconcilePerconaServerMongoDB) handleReplsetInit(ctx context.Context, c
731731
var stderr, stdout bytes.Buffer
732732

733733
hello := []string{"sh", "-c",
734-
mongoCmd + " --eval 'db.runCommand({ hello: 1 }).isWritablePrimary'"}
734+
mongoCmd + " --quiet --eval 'db.runCommand({ hello: 1 }).isWritablePrimary'"}
735735
err = r.clientcmd.Exec(ctx, &pod, "mongod", hello, nil, &stdout, &stderr, false)
736736
if err != nil {
737737
return errors.Wrapf(err, "run hello stdout: %s, stderr: %s", stdout.String(), stderr.String())
738738
}
739739

740740
out := strings.Trim(stdout.String(), "\n")
741741
if out != "true" {
742-
return errors.New("is not the writable primary")
742+
return errors.New(pod.Name + " is not the writable primary")
743743
}
744744

745745
log.Info(pod.Name+" is the writable primary", "replset", replsetName)

0 commit comments

Comments
 (0)