Skip to content
Snippets Groups Projects
Commit ed17b2c3 authored by sousaedu's avatar sousaedu Committed by Mark Beierl
Browse files

Mongod-exporter charm: fixing connection string in HA


Change-Id: I606a36a373c39d7d15e572d90065acd093506de5
Signed-off-by: default avatarsousaedu <eduardo.sousa@canonical.com>
parent 5d1ec6e8
No related branches found
No related tags found
No related merge requests found
......@@ -122,10 +122,15 @@ def _make_pod_envconfig(
Returns:
Dict[str, Any]: pod environment configuration.
"""
parsed = urlparse(relation_state.get("mongodb_connection_string"))
envconfig = {
"MONGODB_URI": relation_state.get("mongodb_connection_string"),
"MONGODB_URI": f"mongodb://{parsed.netloc.split(',')[0]}{parsed.path}",
}
if parsed.query:
envconfig["MONGODB_URI"] += f"?{parsed.query}"
return envconfig
......
......@@ -37,7 +37,6 @@ class TestCharm(unittest.TestCase):
self.harness = Harness(MongodbExporterCharm)
self.harness.set_leader(is_leader=True)
self.harness.begin()
self.harness.update_config(self.config)
def test_on_start_without_relations(self) -> NoReturn:
"""Test installation without any relation."""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment