Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Improve mysql_cli_version parsing to make it work with packages from mariadb package sources #568

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Dherlou
Copy link

@Dherlou Dherlou commented Mar 17, 2025

Background

The mysql_cli_version variable is extracted by parsing the output of {{ mysql_daemon }} --version command.

Problem

While this does work with our MariaDB v10 installation from the default package sources of Ubuntu 22.04 ...:
output: mysql Ver 15.1 Distrib 10.6.18-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper
... it is broken for a MariaDB v11 installation from the official MariaDB package sources (https://mirror.mariadb.org/repo/11.4/ubuntu/):
output: mysql from 11.4.5-MariaDB, client 15.2 for debian-linux-gnu (x86_64) using EditLine wrapper
The latter results in fo being parsed as the mysql_cli_version, leading to a failure in the next task due to the string not being able to be compared correctly during config template deployment.

I am not quite sure whether this is the result of MariaDB v11 or the use of the official MariaDB package sources in order to being able to install MariaDB v11 for Ubuntu 22.04.

Solution proposal

My proposal is to use a regular expression for extraction instead of using fixed offsets.
From my understanding, MySQL outputs its version as <Major>.<Minor>.<Bugfix> whereas MariaDB outputs it as <Major>.<Minor>.<Bugfix>-MariaDB.

However, I was just able to confirm it working correctly for the combination of Ubuntu and MariaDB. Feel free to improve the regex if some other OS database combinations do not work as expected or if you want to further improve its resilience.

…ut more generic by introducing regex parsing
@Dherlou Dherlou changed the title Proposal: Improve mysql_cli_version parsing to make it work with Proposal: Improve mysql_cli_version parsing to make it work with packages from mariadb package sources Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant