From 277c931191194490c5595307c22b721d94294254 Mon Sep 17 00:00:00 2001 From: Vijay Nag B S Date: Tue, 29 Sep 2020 17:23:57 +0530 Subject: [PATCH] Support for mongodb replicaset connection (HA). Change-Id: I36d582f177d36b93b9913dd781c50ac34b2bbb60 Signed-off-by: Vijay Nag B S --- osm_common/dbmongo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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"]] -- 2.25.1