projects
/
osm
/
common.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Adding VIM create constants
[osm/common.git]
/
osm_common
/
dbmongo.py
diff --git
a/osm_common/dbmongo.py
b/osm_common/dbmongo.py
index
d8b373a
..
f5c4d30
100644
(file)
--- a/
osm_common/dbmongo.py
+++ b/
osm_common/dbmongo.py
@@
-16,15
+16,16
@@
# limitations under the License.
# limitations under the License.
-import logging
-from pymongo import MongoClient, errors
-from osm_common.dbbase import DbException, DbBase
-from http import HTTPStatus
-from time import time, sleep
-from copy import deepcopy
from base64 import b64decode
from base64 import b64decode
+from copy import deepcopy
+from http import HTTPStatus
+import logging
+from time import sleep, time
from uuid import uuid4
from uuid import uuid4
+from osm_common.dbbase import DbBase, DbException
+from pymongo import errors, MongoClient
+
__author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>"
# TODO consider use this decorator for database access retries
__author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>"
# TODO consider use this decorator for database access retries
@@
-64,7
+65,7
@@
class DbMongo(DbBase):
conn_timout = 10
def __init__(self, logger_name="db", lock=False):
conn_timout = 10
def __init__(self, logger_name="db", lock=False):
- super().__init__(logger_name
,
lock)
+ super().__init__(logger_name
=logger_name, lock=
lock)
self.client = None
self.db = None
self.database_key = None
self.client = None
self.db = None
self.database_key = None
@@
-104,13
+105,6
@@
class DbMongo(DbBase):
self.client = MongoClient(
config["uri"], replicaSet=config.get("replicaset", None)
)
self.client = MongoClient(
config["uri"], replicaSet=config.get("replicaset", None)
)
- else:
- 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"]]
if "loglevel" in config:
# when all modules are ready
self.db = self.client[config["name"]]
if "loglevel" in config: