New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MongoDB config validation if replica set is used. #1173

Merged
merged 2 commits into from May 22, 2015

Conversation

Projects
None yet
2 participants
@bernd
Member

bernd commented May 22, 2015

It is okay to have an empty mongodb_host if mongodb_replica_set is defined.

Graylog server startup fails without this if a replica set is in use.

Additional whitespace fix.

Fix MongoDB config validation if replica set is used.
It is okay to have an empty mongodb_host if mongodb_replica_set is
defined.

@bernd bernd added the bug label May 22, 2015

@bernd bernd added this to the 1.1.0 milestone May 22, 2015

@bernd

This comment has been minimized.

Member

bernd commented May 22, 2015

Forgot to adjust the test. Sorry...

@@ -173,11 +173,11 @@ public MongoClientURI getMongoClientURI() {
@ValidatorMethod
public void validate() throws ValidationException {
if((isNullOrEmpty(getHost()) || isNullOrEmpty(getDatabase())) && isNullOrEmpty(getUri())) {
if ((isNullOrEmpty(getHost()) || isNullOrEmpty(getDatabase()) || getReplicaSet() == null) && isNullOrEmpty(getUri())) {

This comment has been minimized.

@joschi

joschi May 22, 2015

Contributor

I guess this should be if ((isNullOrEmpty(getHost()) && getReplicaSet() == null) || isNullOrEmpty(getDatabase()) && isNullOrEmpty(getUri())) { instead. Bonus points for checking that the replica set is not empty.

This comment has been minimized.

@bernd

bernd May 22, 2015

Member

You are right, thanks!

@bernd

This comment has been minimized.

Member

bernd commented May 22, 2015

Updated with fixed condition and test.

@joschi

This comment has been minimized.

Contributor

joschi commented May 22, 2015

LGTM.

joschi added a commit that referenced this pull request May 22, 2015

Merge pull request #1173 from Graylog2/fix-mongodb-config-validation
Fix MongoDB config validation if replica set is used.

@joschi joschi merged commit 2786db1 into 1.1 May 22, 2015

1 check passed

continuous-integration/travis-ci/push The Travis CI build passed
Details

@joschi joschi deleted the fix-mongodb-config-validation branch May 22, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment