Skip to content
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 for #178 and autodetect mongo version #184

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gummiboll
Copy link

Connection check always returns OK since MongoClient doesn't block since pymongo 3.0 (see: http://api.mongodb.org/python/current/api/pymongo/mongo_client.html). With this pull-request check_mongodb.py tries to determine which version of mongodb is running directly after mongo_connect so if a bogus host/port is used or mongodb isnt running it will throw a error.

-M is kept so it doesn't break current installations, if -M is specified mongo_version is set to what the user specified if not the autodetected version is used. Also changed mongo_version to a int instead of string.

PS. Don't have any mongodb 3.x installation to test this on so not certain it wont break those.
PPS. Also removed some trailing whitespaces.

@warrenpnz
Copy link
Contributor

Nice, I was just removing the -M option and using # mongo_version = con.server_info()['version'].split('.')[0].strip()
Yours is a lot more error resistant, so I've updated mine to use that now. +1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants