Replaces methods deprecated in pymongo3.0
This is a cherry-pick from f0598b213dd45b8d5dcd1a773b2022104bf8dad3 in Ceilometer. Change-Id: I6e4bf806537fda3002d7c9a084e364ecb5f4303c
This commit is contained in:
parent
d784e72327
commit
b8a678929d
@ -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: '
|
||||
|
Loading…
Reference in New Issue
Block a user