From: David Garcia Date: Fri, 17 Dec 2021 07:30:59 +0000 (+0100) Subject: Fix bug 1833: fix DATA_SOURCE_NAME in mysqld-exporter X-Git-Tag: v12.0.0rc1~68 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F01%2F11501%2F1;p=osm%2Fdevops.git Fix bug 1833: fix DATA_SOURCE_NAME in mysqld-exporter Change-Id: I6641aa68aaa920bbe14ca688b984c5591c0ff72d Signed-off-by: David Garcia --- diff --git a/installers/charm/mysqld-exporter/src/charm.py b/installers/charm/mysqld-exporter/src/charm.py index 91be02a6..46588b9a 100755 --- a/installers/charm/mysqld-exporter/src/charm.py +++ b/installers/charm/mysqld-exporter/src/charm.py @@ -185,9 +185,9 @@ class MysqlExporterCharm(CharmedOsmBase): self._check_missing_dependencies(config) data_source = ( - config.mysql_uri.replace("mysql://", "").split("/")[0] + f'{config.mysql_uri.replace("mysql://", "").replace("@", "@(").split("/")[0]})/' if config.mysql_uri - else f"root:{self.mysql_client.root_password}@{self.mysql_client.host}:{self.mysql_client.port}" + else f"root:{self.mysql_client.root_password}@({self.mysql_client.host}:{self.mysql_client.port})/" ) # Create Builder for the PodSpec