From 41199aee8231925ed214cdc48ed6b103f28d8961 Mon Sep 17 00:00:00 2001
From: Sergiy Markin <smarkin@mirantis.com>
Date: Tue, 28 Jan 2025 16:33:08 +0000
Subject: [PATCH] Update create db user queries

This commit changes the queries to use % instead
of %% in the Host field of CREATE USER and GRANT
ALL statements.

It also uplifts fresh jammy images for mariadb.

Change-Id: I6779f55d962bc9d8efc3b3bfe05b72cbe0b7f863
---
 helm-toolkit/templates/scripts/_db-init.py.tpl | 4 ++--
 mariadb/values.yaml                            | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/helm-toolkit/templates/scripts/_db-init.py.tpl b/helm-toolkit/templates/scripts/_db-init.py.tpl
index 1917f78b4d..35d04d886d 100644
--- a/helm-toolkit/templates/scripts/_db-init.py.tpl
+++ b/helm-toolkit/templates/scripts/_db-init.py.tpl
@@ -140,10 +140,10 @@ except:
 try:
     with root_engine.connect() as connection:
         connection.execute(
-            text("CREATE USER IF NOT EXISTS \'{0}\'@\'%%\' IDENTIFIED BY \'{1}\' {2}".format(
+            text("CREATE USER IF NOT EXISTS \'{0}\'@\'%\' IDENTIFIED BY \'{1}\' {2}".format(
                 user, password, mysql_x509)))
         connection.execute(
-            text("GRANT ALL ON `{0}`.* TO \'{1}\'@\'%%\'".format(database, user)))
+            text("GRANT ALL ON `{0}`.* TO \'{1}\'@\'%\'".format(database, user)))
         try:
             connection.commit()
         except AttributeError:
diff --git a/mariadb/values.yaml b/mariadb/values.yaml
index 1a2f8d77db..4fa5fb50d1 100644
--- a/mariadb/values.yaml
+++ b/mariadb/values.yaml
@@ -20,16 +20,16 @@ release_group: null
 
 images:
   tags:
-    mariadb: docker.io/openstackhelm/mariadb:latest-ubuntu_focal
+    mariadb: docker.io/openstackhelm/mariadb:latest-ubuntu_jammy
     prometheus_create_mysql_user: docker.io/library/mariadb:10.5.9-focal
     prometheus_mysql_exporter: docker.io/prom/mysqld-exporter:v0.12.1
     prometheus_mysql_exporter_helm_tests: docker.io/openstackhelm/heat:wallaby-ubuntu_focal
-    dep_check: quay.io/airshipit/kubernetes-entrypoint:latest-ubuntu_focal
+    dep_check: quay.io/airshipit/kubernetes-entrypoint:latest-ubuntu_jammy
     image_repo_sync: docker.io/library/docker:17.07.0
-    mariadb_backup: quay.io/airshipit/porthole-mysqlclient-utility:latest-ubuntu_focal
+    mariadb_backup: quay.io/airshipit/porthole-mysqlclient-utility:latest-ubuntu_jammy
     ks_user: docker.io/openstackhelm/heat:wallaby-ubuntu_focal
     scripted_test: docker.io/openstackhelm/mariadb:ubuntu_focal-20210415
-    mariadb_controller: docker.io/openstackhelm/mariadb:latest-ubuntu_focal
+    mariadb_controller: docker.io/openstackhelm/mariadb:latest-ubuntu_jammy
   pull_policy: "IfNotPresent"
   local_registry:
     active: false