From 7e0eb1359144e47425da40504350f0d7cdc408e4 Mon Sep 17 00:00:00 2001 From: Eduardo Sousa Date: Fri, 21 Jun 2019 11:50:21 +0100 Subject: [PATCH] Adding suport for FsMongo Change-Id: Ic864d65c5ef551237a471ee8c2b8f157b2447791 Signed-off-by: Eduardo Sousa --- Dockerfile.local | 4 ++++ osm_nbi/engine.py | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Dockerfile.local b/Dockerfile.local index f49bf2d..b96d918 100644 --- a/Dockerfile.local +++ b/Dockerfile.local @@ -64,7 +64,11 @@ ENV OSMNBI_SOCKET_PORT 9999 ENV OSMNBI_SERVER_SSL_CERTIFICATE /app/NBI/osm_nbi/http/cert.pem ENV OSMNBI_SERVER_SSL_PRIVATE_KEY /app/NBI/osm_nbi/http/privkey.pem # storage +ENV OSMNBI_STORAGE_DRIVER local ENV OSMNBI_STORAGE_PATH /app/storage +#ENV OSMNBI_STORAGE_DRIVER mongo +#ENV OSMNBI_STORAGE_URI mongodb://mongo:27017 +#ENV OSMNBI_STORAGE_COLLECTION files # database ENV OSMNBI_DATABASE_DRIVER mongo ENV OSMNBI_DATABASE_HOST mongo diff --git a/osm_nbi/engine.py b/osm_nbi/engine.py index 0cd0666..f9fb1e7 100644 --- a/osm_nbi/engine.py +++ b/osm_nbi/engine.py @@ -15,7 +15,7 @@ import logging import yaml -from osm_common import dbmongo, dbmemory, fslocal, msglocal, msgkafka, version as common_version +from osm_common import dbmongo, dbmemory, fslocal, fsmongo, msglocal, msgkafka, version as common_version from osm_common.dbbase import DbException from osm_common.fsbase import FsException from osm_common.msgbase import MsgException @@ -106,6 +106,9 @@ class Engine(object): if config["storage"]["driver"] == "local": self.fs = fslocal.FsLocal() self.fs.fs_connect(config["storage"]) + elif config["storage"]["driver"] == "mongo": + self.fs = fsmongo.FsMongo() + self.fs.fs_connect(config["storage"]) else: raise EngineException("Invalid configuration param '{}' at '[storage]':'driver'".format( config["storage"]["driver"])) -- 2.25.1