diff --git a/lib/puppet/provider/mysql.rb b/lib/puppet/provider/mysql.rb index ef750039f..5ee43cab1 100644 --- a/lib/puppet/provider/mysql.rb +++ b/lib/puppet/provider/mysql.rb @@ -38,9 +38,21 @@ class Puppet::Provider::Mysql < Puppet::Provider ].join(':') # rubocop:disable Style/HashSyntax - commands :mysql_raw => 'mysql' - commands :mysqld => 'mysqld' - commands :mysqladmin => 'mysqladmin' + if File.symlink?(Facter::Core::Execution.which('mysql')) + commands :mysql_raw => File.readlink(Facter::Core::Execution.which('mysql')) + else + commands :mysql_raw => Facter::Core::Execution.which('mysql') + end + if File.symlink?(Facter::Core::Execution.which('mysqld')) + commands :mysqld => File.readlink(Facter::Core::Execution.which('mysqld')) + else + commands :mysqld => 'mysqld' + end + if File.symlink?(Facter::Core::Execution.which('mysqladmin')) + commands :mysqladmin => File.readlink(Facter::Core::Execution.which('mysqladmin')) + else + commands :mysqladmin => 'mysqladmin' + end # rubocop:enable Style/HashSyntax # Optional defaults file diff --git a/tasks/export.rb b/tasks/export.rb index 7688633ae..c57000456 100755 --- a/tasks/export.rb +++ b/tasks/export.rb @@ -6,7 +6,11 @@ require 'puppet' def get(file, database, user, password) - cmd_string = 'mysqldump' + if File.symlink?(Facter::Core::Execution.which('mysqldump')) + cmd_string = File.readlink(Facter::Core::Execution.which('mysqldump')) + else + cmd_string = 'mysqldump' + end cmd_string << " --databases #{database}" unless database.nil? cmd_string << " --user=#{user}" unless user.nil? cmd_string << " --password=#{password}" unless password.nil?