Skip to content

Commit

Permalink
Use mariadb* commands on MariaDB flavor
Browse files Browse the repository at this point in the history
  • Loading branch information
OxCom authored and neomilium committed Oct 16, 2024
1 parent be2a27c commit a04e2d2
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions lib/puppet/provider/mysql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 => 'mariadb-admin'
# 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")
Expand Down

0 comments on commit a04e2d2

Please sign in to comment.