Support for mongodb replicaset connection (HA). 60/9760/3 bug1511 branch-bug1511-start release-v9.0-start v9.0.0 v9.0.0rc1 v9.1.0 v9.1.1 v9.1.1rc1
authorVijay Nag B S <vijaynag.bs@tataelxsi.co.in>
Tue, 29 Sep 2020 11:53:57 +0000 (17:23 +0530)
committervijaynag <vijaynag.bs@tataelxsi.co.in>
Thu, 5 Nov 2020 08:49:15 +0000 (09:49 +0100)
Change-Id: I36d582f177d36b93b9913dd781c50ac34b2bbb60
Signed-off-by: Vijay Nag B S <vijaynag.bs@tataelxsi.co.in>
osm_common/dbmongo.py

index b0686aa..56f387b 100644 (file)
@@ -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"]]