Skip to content

(MODULES-11594) Fix SLES-15 nightly errors #1679

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

Merged
merged 1 commit into from
Jul 17, 2025
Merged
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
6 changes: 6 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -401,10 +401,16 @@
}
}

$skip_ssl = ($facts['os']['name'] == 'SLES' and $facts['os']['release']['major'] =~ /^15/) ? {
true => true,
false => undef,
}

$default_options = {
'client' => {
'port' => '3306',
'socket' => $mysql::params::socket,
'skip-ssl' => $skip_ssl,
},
'mysqld_safe' => {
'nice' => '0',
Expand Down
7 changes: 4 additions & 3 deletions spec/acceptance/types/mysql_database_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require 'spec_helper_acceptance'

describe 'mysql_database' do
mysql_cmd = get_db_cmd
describe 'setup' do
pp = <<-MANIFEST
class { 'mysql::server': }
Expand All @@ -25,7 +26,7 @@ class { 'mysql::server': }
end

it 'finds the database #stdout' do
run_shell("mysql -NBe \"SHOW DATABASES LIKE 'spec_db'\"") do |r|
run_shell("#{mysql_cmd} -NBe \"SHOW DATABASES LIKE 'spec_db'\"") do |r|
expect(r.stdout).to match(%r{^spec_db$})
expect(r.stderr).to be_empty
end
Expand All @@ -48,14 +49,14 @@ class { 'mysql::server': }
end

it 'finds latin1 db #stdout' do
run_shell("mysql -NBe \"SHOW VARIABLES LIKE '%_database'\" spec_latin1") do |r|
run_shell("#{mysql_cmd} -NBe \"SHOW VARIABLES LIKE '%_database'\" spec_latin1") do |r|
expect(r.stdout).to match(%r{^character_set_database\tlatin1\ncollation_database\tlatin1_swedish_ci$})
expect(r.stderr).to be_empty
end
end

it 'finds utf8 db #stdout' do
run_shell("mysql -NBe \"SHOW VARIABLES LIKE '%_database'\" spec_utf8") do |r|
run_shell("#{mysql_cmd} -NBe \"SHOW VARIABLES LIKE '%_database'\" spec_utf8") do |r|
expect(r.stdout).to match(%r{^character_set_database\tutf8(mb3)?\ncollation_database\tutf8(mb3)?_general_ci$})
expect(r.stderr).to be_empty
end
Expand Down
52 changes: 27 additions & 25 deletions spec/acceptance/types/mysql_grant_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
require 'spec_helper_acceptance'

describe 'mysql_grant' do
mysql_cmd = get_db_cmd

before(:all) do
pp = <<-MANIFEST
class { 'mysql::server':
Expand Down Expand Up @@ -31,7 +33,7 @@ class { 'mysql::server':
end

it 'does not find the user' do
result = run_shell('mysql -NBe "SHOW GRANTS FOR test1@tester"', expect_failures: true)
result = run_shell("#{mysql_cmd} -NBe \"SHOW GRANTS FOR test1@tester\"", expect_failures: true)
expect(result.stderr).to contain(%r{There is no such grant defined for user 'test1' on host 'tester'})
end
end
Expand All @@ -53,7 +55,7 @@ class { 'mysql::server':
end

it 'does not find the user' do
result = run_shell('mysql -NBe "SHOW GRANTS FOR atest@tester"', expect_failures: true)
result = run_shell("#{mysql_cmd} -NBe \"SHOW GRANTS FOR atest@tester\"", expect_failures: true)
expect(result.stderr).to contain(%r{There is no such grant defined for user 'atest' on host 'tester'})
end
end
Expand All @@ -76,7 +78,7 @@ class { 'mysql::server':
end

it 'finds the user #stdout' do
result = run_shell('mysql -NBe "SHOW GRANTS FOR test2@tester"')
result = run_shell("#{mysql_cmd} -NBe \"SHOW GRANTS FOR test2@tester\"")
expect(result.stdout).to contain(%r{GRANT SELECT, UPDATE.*TO ['|`]test2['|`]@['|`]tester['|`]})
expect(result.stderr).to be_empty
end
Expand All @@ -100,7 +102,7 @@ class { 'mysql::server':
end

it 'finds the user #stdout' do
result = run_shell("mysql -NBe \"SHOW GRANTS FOR 'test-2'@tester\"")
result = run_shell("#{mysql_cmd} -NBe \"SHOW GRANTS FOR 'test-2'@tester\"")
expect(result.stdout).to contain(%r{GRANT SELECT, UPDATE.*TO ['|`]test-2['|`]@['|`]tester['|`]})
expect(result.stderr).to be_empty
end
Expand All @@ -125,7 +127,7 @@ class { 'mysql::server':
end

it 'finds the user #stdout' do
result = run_shell('mysql -NBe "SHOW GRANTS FOR test3@tester"')
result = run_shell("#{mysql_cmd} -NBe \"SHOW GRANTS FOR test3@tester\"")
expect(result.stdout).to contain(%r{GRANT SELECT, UPDATE ON `test`.* TO ['|`]test3['|`]@['|`]tester['|`] WITH GRANT OPTION$})
expect(result.stderr).to be_empty
end
Expand Down Expand Up @@ -169,7 +171,7 @@ class { 'mysql::server':
end

it 'finds the user #stdout' do
result = run_shell('mysql -NBe "SHOW GRANTS FOR test4@tester"')
result = run_shell("#{mysql_cmd} -NBe \"SHOW GRANTS FOR test4@tester\"")
expect(result.stdout).to contain(%r{GRANT ALL PRIVILEGES ON `test`.* TO ['|`]test4['|`]@['|`]tester['|`] WITH GRANT OPTION})
expect(result.stderr).to be_empty
end
Expand Down Expand Up @@ -234,34 +236,34 @@ class { 'mysql::server':
end

it 'finds short hostname #stdout' do
result = run_shell('mysql -NBe "SHOW GRANTS FOR test@short"')
result = run_shell("#{mysql_cmd} -NBe \"SHOW GRANTS FOR test@short\"")
expect(result.stdout).to contain(%r{GRANT ALL PRIVILEGES ON ['|`]test['|`].* TO ['|`]test['|`]@['|`]short['|`]})
expect(result.stderr).to be_empty
end

it 'finds long hostname #stdout' do
run_shell("mysql -NBe \"SHOW GRANTS FOR 'test'@'long.hostname.com'\"") do |r|
run_shell("#{mysql_cmd} -NBe \"SHOW GRANTS FOR 'test'@'long.hostname.com'\"") do |r|
expect(r.stdout).to match(%r{GRANT ALL PRIVILEGES ON ['|`]test['|`].* TO ['|`]test['|`]@['|`]long.hostname.com['|`]})
expect(r.stderr).to be_empty
end
end

it 'finds ipv4 #stdout' do
run_shell("mysql -NBe \"SHOW GRANTS FOR 'test'@'192.168.5.6'\"") do |r|
run_shell("#{mysql_cmd} -NBe \"SHOW GRANTS FOR 'test'@'192.168.5.6'\"") do |r|
expect(r.stdout).to match(%r{GRANT ALL PRIVILEGES ON ['|`]test['|`].* TO ['|`]test['|`]@['|`]192.168.5.6['|`]})
expect(r.stderr).to be_empty
end
end

it 'finds ipv6 #stdout' do
run_shell("mysql -NBe \"SHOW GRANTS FOR 'test'@'2607:f0d0:1002:0051:0000:0000:0000:0004'\"") do |r|
run_shell("#{mysql_cmd} -NBe \"SHOW GRANTS FOR 'test'@'2607:f0d0:1002:0051:0000:0000:0000:0004'\"") do |r|
expect(r.stdout).to match(%r{GRANT ALL PRIVILEGES ON ['|`]test['|`].* TO ['|`]test['|`]@['|`]2607:f0d0:1002:0051:0000:0000:0000:0004['|`]})
expect(r.stderr).to be_empty
end
end

it 'finds short ipv6 #stdout' do
run_shell("mysql -NBe \"SHOW GRANTS FOR 'test'@'::1/128'\"") do |r|
run_shell("#{mysql_cmd} -NBe \"SHOW GRANTS FOR 'test'@'::1/128'\"") do |r|
expect(r.stdout).to match(%r{GRANT ALL PRIVILEGES ON ['|`]test['|`].* TO ['|`]test['|`]@['|`]::1/128['|`]})
expect(r.stderr).to be_empty
end
Expand All @@ -279,9 +281,9 @@ class { 'mysql::server':
}

exec { 'mysql-create-table':
command => '/usr/bin/mysql -NBe "CREATE TABLE foo.bar (name VARCHAR(20))"',
command => '/usr/bin/#{mysql_cmd} -NBe "CREATE TABLE foo.bar (name VARCHAR(20))"',
environment => "HOME=${::root_home}",
unless => '/usr/bin/mysql -NBe "SELECT 1 FROM foo.bar LIMIT 1;"',
unless => '/usr/bin/#{mysql_cmd} -NBe "SELECT 1 FROM foo.bar LIMIT 1;"',
require => Mysql_database['foo'],
}

Expand Down Expand Up @@ -387,7 +389,7 @@ class { 'mysql::server':
describe 'adding procedure privileges' do
pp = <<-MANIFEST
exec { 'simpleproc-create':
command => 'mysql --user="root" --password="password" --database=mysql --delimiter="//" -NBe "CREATE PROCEDURE simpleproc (OUT param1 INT) BEGIN SELECT COUNT(*) INTO param1 FROM t; end//"',
command => "#{mysql_cmd} --user='root' --password='password' --database=mysql --delimiter='//' -NBe \\"CREATE PROCEDURE simpleproc (OUT param1 INT) BEGIN SELECT COUNT(*) INTO param1 FROM t; END//\\"",
path => '/usr/bin/',
before => Mysql_user['test2@tester'],
}
Expand All @@ -407,7 +409,7 @@ class { 'mysql::server':
end

it 'finds the user #stdout' do
result = run_shell('mysql -NBe "SHOW GRANTS FOR test2@tester"')
result = run_shell("#{mysql_cmd} -NBe \"SHOW GRANTS FOR test2@tester\"")
expect(result.stdout).to match(%r{GRANT EXECUTE ON PROCEDURE `mysql`.`simpleproc` TO ['|`]test2['|`]@['|`]tester['|`]})
expect(result.stderr).to be_empty
end
Expand All @@ -417,7 +419,7 @@ class { 'mysql::server':
it 'works without errors' do
pp = <<-MANIFEST
exec { 'simplefunc-create':
command => '/usr/bin/mysql --user="root" --password="password" --database=mysql -NBe "CREATE FUNCTION simplefunc (s CHAR(20)) RETURNS CHAR(50) DETERMINISTIC RETURN CONCAT(\\'Hello, \\', s, \\'!\\')"',
command => "/usr/bin/#{mysql_cmd} --user='root' --password='password' --database=mysql -NBe \\"CREATE FUNCTION simplefunc (s CHAR(20)) RETURNS CHAR(50) DETERMINISTIC RETURN CONCAT('Hello, ', s, '!')\\"",
before => Mysql_user['test3@tester'],
}

Expand All @@ -438,7 +440,7 @@ class { 'mysql::server':
end

it 'finds the user' do
result = run_shell('mysql -NBe "SHOW GRANTS FOR test3@tester"')
result = run_shell("#{mysql_cmd} -NBe \"SHOW GRANTS FOR test3@tester\"")
expect(result.stdout).to match(%r{GRANT EXECUTE ON FUNCTION `mysql`.`simplefunc` TO ['|`]test3['|`]@['|`]tester['|`]})
expect(result.stderr).to be_empty
end
Expand All @@ -463,7 +465,7 @@ class { 'mysql::server':
end

it 'finds the user #stdout' do
run_shell('mysql -NBe "SHOW GRANTS FOR proxy1@tester"') do |r|
run_shell("#{mysql_cmd} -NBe \"SHOW GRANTS FOR proxy1@tester\"") do |r|
expect(r.stdout).to match(%r{GRANT USAGE ON *.* TO ['|`]proxy1['|`]@['|`]tester['|`]\nGRANT PROXY ON ['|`]proxy_user['|`]@['|`]proxy_host['|`] TO ['|`]proxy1['|`]@['|`]tester['|`]\n})
expect(r.stderr).to be_empty
end
Expand All @@ -488,7 +490,7 @@ class { 'mysql::server':
end

it 'finds the user #stdout' do
run_shell('mysql -NBe "SHOW GRANTS FOR proxy1@tester"') do |r|
run_shell("#{mysql_cmd} -NBe \"SHOW GRANTS FOR proxy1@tester\"") do |r|
expect(r.stdout).not_to match(%r{GRANT PROXY ON 'proxy_user'@'proxy_host' TO ['|`]proxy1['|`]@['|`]tester['|`]})
expect(r.stderr).to be_empty
end
Expand All @@ -514,7 +516,7 @@ class { 'mysql::server':
end

it 'does not find the user' do
result = run_shell('mysql -NBe "SHOW GRANTS FOR proxy2@tester"', expect_failures: true)
result = run_shell("#{mysql_cmd} -NBe \"SHOW GRANTS FOR proxy2@tester\"", expect_failures: true)
expect(result.stderr).to match(%r{There is no such grant defined for user 'proxy2' on host 'tester'})
end
end
Expand All @@ -538,7 +540,7 @@ class { 'mysql::server':
end

it 'does not find the user' do
result = run_shell('mysql -NBe "SHOW GRANTS FOR proxy2@tester"', expect_failures: true)
result = run_shell("#{mysql_cmd} -NBe \"SHOW GRANTS FOR proxy2@tester\"", expect_failures: true)
expect(result.stderr).to match(%r{There is no such grant defined for user 'proxy2' on host 'tester'})
end
end
Expand All @@ -562,7 +564,7 @@ class { 'mysql::server':
end

it 'does not find the user' do
result = run_shell('mysql -NBe "SHOW GRANTS FOR proxy3@tester"', expect_failures: true)
result = run_shell("#{mysql_cmd} -NBe \"SHOW GRANTS FOR proxy3@tester\"", expect_failures: true)
expect(result.stderr).to contain(%r{There is no such grant defined for user 'proxy3' on host 'tester'})
end
end
Expand Down Expand Up @@ -609,13 +611,13 @@ class { 'mysql::server':

it 'fails with fqdn' do
unless Gem::Version.new(mysql_version) > Gem::Version.new('5.7.0')
result = run_shell('mysql -NBe "SHOW GRANTS FOR [email protected]"', expect_failures: true)
result = run_shell("#{mysql_cmd} -NBe \"SHOW GRANTS FOR [email protected]\"", expect_failures: true)
expect(result.stderr).to contain(%r{There is no such grant defined for user 'test' on host 'fqdn.com'})
end
end

it 'finds ipv4 #stdout' do
run_shell("mysql -NBe \"SHOW GRANTS FOR 'test'@'192.168.5.7'\"") do |r|
run_shell("#{mysql_cmd} -NBe \"SHOW GRANTS FOR 'test'@'192.168.5.7'\"") do |r|
expect(r.stdout).to match(%r{GRANT ALL PRIVILEGES ON `test`.* TO ['|`]test['|`]@['|`]192.168.5.7['|`]})
expect(r.stderr).to be_empty
end
Expand Down Expand Up @@ -694,7 +696,7 @@ class { 'mysql::server': override_options => { 'root_password' => 'password' } }
end

it 'has the table' do
result = run_shell("mysql -e 'show tables;' grant_spec_db|grep grant_spec_table")
result = run_shell("#{mysql_cmd} -e 'show tables;' grant_spec_db|grep grant_spec_table")
expect(result.exit_code).to be_zero
end
end
Expand Down
Loading
Loading