From: Vijay Nag B S Date: Tue, 29 Sep 2020 11:53:57 +0000 (+0530) Subject: Support for mongodb replicaset connection (HA). X-Git-Tag: release-v9.0-start^0 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fbug1511;p=osm%2Fcommon.git Support for mongodb replicaset connection (HA). Change-Id: I36d582f177d36b93b9913dd781c50ac34b2bbb60 Signed-off-by: Vijay Nag B S --- diff --git a/osm_common/dbmongo.py b/osm_common/dbmongo.py index b0686aa..56f387b 100644 --- a/osm_common/dbmongo.py +++ b/osm_common/dbmongo.py @@ -99,9 +99,9 @@ class DbMongo(DbBase): self.database_key = master_key self.set_secret_key(master_key) if config.get("uri"): - self.client = MongoClient(config["uri"]) + self.client = MongoClient(config["uri"], replicaSet=config.get("replicaset", None)) else: - self.client = MongoClient(config["host"], config["port"]) + self.client = MongoClient(config["host"], config["port"], replicaSet=config.get("replicaset", None)) # TODO add as parameters also username=config.get("user"), password=config.get("password")) # when all modules are ready self.db = self.client[config["name"]]