Skip to content

Commit c0c8aee

Browse files
OxComRomuald Conty
authored and
Romuald Conty
committed
Use mariadb* commands on MariaDB flavor
1 parent b380c2a commit c0c8aee

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

lib/puppet/provider/mysql.rb

+21-3
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,29 @@ class Puppet::Provider::Mysql < Puppet::Provider
3838
].join(':')
3939

4040
# rubocop:disable Style/HashSyntax
41-
commands :mysql_raw => 'mysql'
42-
commands :mysqld => 'mysqld'
43-
commands :mysqladmin => 'mysqladmin'
41+
commands :mysql_client => 'mysql'
42+
commands :mariadb_client => 'mariadb'
43+
commands :mysqld_service => 'mysqld'
44+
commands :mariadbd_service => 'mariadbd'
45+
commands :mysql_admin => 'mysqladmin'
46+
commands :mariadb_admin => 'mariadb-admin'
4447
# rubocop:enable Style/HashSyntax
4548

49+
def self.mysql_raw(*args)
50+
mysqld_version_string.scan(%r{mariadb}i) { return mariadb_client(*args) }
51+
mysql_client(*args)
52+
end
53+
54+
def self.mysqld(*args)
55+
mysqld_version_string.scan(%r{mariadb}i) { return mariadbd_service(*args) }
56+
mysqld_service(*args)
57+
end
58+
59+
def self.mysqladmin(*args)
60+
mysqld_version_string.scan(%r{mariadb}i) { return mariadb_admin(*args) }
61+
mysql_admin(*args)
62+
end
63+
4664
# Optional defaults file
4765
def self.defaults_file
4866
"--defaults-extra-file=#{Facter.value(:root_home)}/.my.cnf" if File.file?("#{Facter.value(:root_home)}/.my.cnf")

0 commit comments

Comments
 (0)