From 89e933d55a1bcaabfed140d09aea97d90df9398d Mon Sep 17 00:00:00 2001 From: Juan Date: Mon, 12 Nov 2018 16:17:08 -0300 Subject: [PATCH] Added support for mongodb High availability, changed cfg from host, port to url Change-Id: I8a5d2174927120e2706eaba5bdee38f60d4a4a9d Signed-off-by: Juan --- osm_common/dbmongo.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osm_common/dbmongo.py b/osm_common/dbmongo.py index 0f89c96..6159e6a 100644 --- a/osm_common/dbmongo.py +++ b/osm_common/dbmongo.py @@ -80,7 +80,10 @@ class DbMongo(DbBase): master_key = config.get("commonkey") or config.get("masterpassword") if master_key: self.set_secret_key(master_key) - self.client = MongoClient(config["host"], config["port"]) + if config.get("url"): + self.client = MongoClient(config["url"]) + else: + self.client = MongoClient(config["host"], config["port"]) # 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