Adding suport for FsMongo 91/7691/7
authorEduardo Sousa <eduardo.sousa@canonical.com>
Fri, 21 Jun 2019 10:50:21 +0000 (11:50 +0100)
committerEduardo Sousa <eduardo.sousa@canonical.com>
Fri, 29 Nov 2019 15:58:04 +0000 (15:58 +0000)
Change-Id: Ic864d65c5ef551237a471ee8c2b8f157b2447791
Signed-off-by: Eduardo Sousa <eduardo.sousa@canonical.com>
Dockerfile.local
osm_nbi/engine.py

index f49bf2d..b96d918 100644 (file)
@@ -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
index 0cd0666..f9fb1e7 100644 (file)
@@ -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"]))