From 13ac7a40f8efd8f7135ad06260663ff7e1f63d24 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 Signed-off-by: garciadeblas --- 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 3de900b..16ab881 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