Adding support for FsMongo 92/7692/6
authorEduardo Sousa <eduardo.sousa@canonical.com>
Fri, 21 Jun 2019 10:54:56 +0000 (11:54 +0100)
committerEduardo Sousa <eduardo.sousa@canonical.com>
Fri, 29 Nov 2019 14:09:33 +0000 (14:09 +0000)
Change-Id: Ied3a67f98e3486d78a366dbcc2c10cd726c41745
Signed-off-by: Eduardo Sousa <eduardo.sousa@canonical.com>
Dockerfile.local
osm_lcm/lcm.py

index a905732..7898a84 100644 (file)
@@ -79,8 +79,11 @@ ENV OSMLCM_DATABASE_URI mongodb://mongo:27017
 # ENV OSMLCM_DATABASE_PASSWORD  xxx
 
 #storage
-ENV OSMLCM_STORAGE_DRIVER  local
-ENV OSMLCM_STORAGE_PATH    /app/storage
+ENV OSMLCM_STORAGE_DRIVER                       local
+ENV OSMLCM_STORAGE_PATH                         /app/storage
+#ENV OSMLCM_STORAGE_DRIVER                       mongo
+#ENV OSMNBI_STORAGE_URI                          mongodb://mongo:27017
+#ENV OSMLCM_STORAGE_COLLECTION                   files
 
 # message
 ENV OSMLCM_MESSAGE_DRIVER  kafka
index 3569904..de829bd 100644 (file)
@@ -38,7 +38,7 @@ from time import time, sleep
 from osm_lcm.lcm_utils import versiontuple, LcmException, TaskRegistry, LcmExceptionExit
 from osm_lcm import version as lcm_version, version_date as lcm_version_date
 
-from osm_common import dbmemory, dbmongo, fslocal, msglocal, msgkafka
+from osm_common import dbmemory, dbmongo, fslocal, fsmongo, msglocal, msgkafka
 from osm_common import version as common_version
 from osm_common.dbbase import DbException
 from osm_common.fsbase import FsException
@@ -158,6 +158,9 @@ class Lcm:
             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 LcmException("Invalid configuration param '{}' at '[storage]':'driver'".format(
                     config["storage"]["driver"]))