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

Fix #1580 Read symlinks for mysql commands that are deprecated in MariaDB 11 #1650

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions lib/puppet/provider/mysql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion tasks/export.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
require 'puppet'

def get(file, database, user, password)
cmd_string = 'mysqldump'
if File.symlink?(Facter::Core::Execution.which('mysqldump'))

Check failure on line 9 in tasks/export.rb

View workflow job for this annotation

GitHub Actions / Spec / Spec tests (Puppet: ~> 7.24, Ruby Ver: 2.7)

Style/ConditionalAssignment: Use the return of the conditional for variable assignment and comparison.

Check failure on line 9 in tasks/export.rb

View workflow job for this annotation

GitHub Actions / Spec / Spec tests (Puppet: ~> 8.0, Ruby Ver: 3.2)

Style/ConditionalAssignment: Use the return of the conditional for variable assignment and comparison.
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?
Expand Down
Loading