Fixing mongodb_uri in NBI/LCM for storage 22/10822/1
authorsousaedu <eduardo.sousa@canonical.com>
Mon, 17 May 2021 19:17:37 +0000 (21:17 +0200)
committersousaedu <eduardo.sousa@canonical.com>
Mon, 17 May 2021 19:17:41 +0000 (21:17 +0200)
NBI and LCM require the mongodb_uri to share the files between them.
This wasn't being setup when the charm was provided with a string for
an external MongoDB instance. This commit fix that.

Change-Id: Ie70f7033bd32f9c590a54efc216913098bc3356c
Signed-off-by: sousaedu <eduardo.sousa@canonical.com>
installers/charm/lcm/src/charm.py
installers/charm/nbi/src/charm.py

index 10257ba..4e0b4be 100755 (executable)
@@ -189,7 +189,8 @@ class LcmCharm(CharmedOsmBase):
                 "OSMLCM_STORAGE_DRIVER": "mongo",
                 "OSMLCM_STORAGE_PATH": "/app/storage",
                 "OSMLCM_STORAGE_COLLECTION": "files",
-                "OSMLCM_STORAGE_URI": self.mongodb_client.connection_string,
+                "OSMLCM_STORAGE_URI": config.mongodb_uri
+                or self.mongodb_client.connection_string,
             }
         )
         if config.vca_host:
index 550c88b..bbbf5ec 100755 (executable)
@@ -210,7 +210,8 @@ class NbiCharm(CharmedOsmBase):
                 "OSMNBI_STORAGE_DRIVER": "mongo",
                 "OSMNBI_STORAGE_PATH": "/app/storage",
                 "OSMNBI_STORAGE_COLLECTION": "files",
-                "OSMNBI_STORAGE_URI": self.mongodb_client.connection_string,
+                "OSMNBI_STORAGE_URI": config.mongodb_uri
+                or self.mongodb_client.connection_string,
                 # Prometheus configuration
                 "OSMNBI_PROMETHEUS_HOST": self.prometheus_client.hostname,
                 "OSMNBI_PROMETHEUS_PORT": self.prometheus_client.port,