fix connection function to mongo

connecting to mongo using "pymongo.connection.Connection" did not work on different versions of mongo.
this change fixes the connection issue.
This commit is contained in:
nleib 2015-05-19 12:37:32 +03:00 committed by rallytime
parent b1c98a38ed
commit 5d520c9377

View file

@ -59,7 +59,7 @@ def _connect(user=None, password=None, host=None, port=None, database='admin'):
port = __salt__['config.option']('mongodb.port')
try:
conn = pymongo.connection.Connection(host=host, port=port)
conn = pymongo.MongoClient(host=host, port=port)
mdb = pymongo.database.Database(conn, database)
if user and password:
mdb.authenticate(user, password)