From 02e3ab5d241b9e97e93cddbdd021823a92e50cd9 Mon Sep 17 00:00:00 2001 From: oxcom Date: Fri, 29 Mar 2024 15:32:07 +0100 Subject: [PATCH] Reolse #1580: support mariadb 11.x --- lib/puppet/provider/mysql.rb | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/puppet/provider/mysql.rb b/lib/puppet/provider/mysql.rb index ef750039f..e6ec5dad0 100644 --- a/lib/puppet/provider/mysql.rb +++ b/lib/puppet/provider/mysql.rb @@ -38,11 +38,29 @@ class Puppet::Provider::Mysql < Puppet::Provider ].join(':') # rubocop:disable Style/HashSyntax - commands :mysql_raw => 'mysql' - commands :mysqld => 'mysqld' - commands :mysqladmin => 'mysqladmin' + commands :mysql_client => 'mysql' + commands :mariadb_client => 'mariadb' + commands :mysqld_service => 'mysqld' + commands :mariadbd_service => 'mariadbd' + commands :mysql_admin => 'mysqladmin' + commands :mariadb_admin => 'mysqladmin' # rubocop:enable Style/HashSyntax + def self.mysql_raw(*args) + mysqld_version_string.scan(%r{mariadb}i) { return mariadb_client(*args) } + mysql_client(*args) + end + + def self.mysqld(*args) + mysqld_version_string.scan(%r{mariadb}i) { return mariadbd_service(*args) } + mysqld_service(*args) + end + + def self.mysqladmin(*args) + mysqld_version_string.scan(%r{mariadb}i) { return mariadb_admin(*args) } + mysql_admin(*args) + end + # Optional defaults file def self.defaults_file "--defaults-extra-file=#{Facter.value(:root_home)}/.my.cnf" if File.file?("#{Facter.value(:root_home)}/.my.cnf")