Replaces methods deprecated in pymongo3.0

This is a cherry-pick from f0598b213dd45b8d5dcd1a773b2022104bf8dad3 in
Ceilometer.

Change-Id: I6e4bf806537fda3002d7c9a084e364ecb5f4303c
This commit is contained in:
Julien Danjou 2015-06-29 12:02:43 +02:00
parent d784e72327
commit b8a678929d

View File

@ -90,13 +90,11 @@ class ConnectionPool(object):
@staticmethod
def _mongo_connect(url):
try:
if cfg.CONF.database.mongodb_replica_set:
client = MongoProxy(
pymongo.MongoReplicaSetClient(
url,
replicaSet=cfg.CONF.database.mongodb_replica_set))
else:
client = MongoProxy(pymongo.MongoClient(url))
client = MongoProxy(
pymongo.MongoClient(
url, replicaSet=cfg.CONF.database.mongodb_replica_set
)
)
return client
except pymongo.errors.ConnectionFailure as e:
LOG.warn(_('Unable to connect to the database server: '