Skip to content

Commit 3cc1d4e

Browse files
Merge pull request #1679 from puppetlabs/MODULES-11594
(MODULES-11594) Fix SLES-15 nightly errors
2 parents 746e056 + fe50af9 commit 3cc1d4e

File tree

5 files changed

+58
-44
lines changed

5 files changed

+58
-44
lines changed

manifests/params.pp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,10 +401,16 @@
401401
}
402402
}
403403

404+
$skip_ssl = ($facts['os']['name'] == 'SLES' and $facts['os']['release']['major'] =~ /^15/) ? {
405+
true => true,
406+
false => undef,
407+
}
408+
404409
$default_options = {
405410
'client' => {
406411
'port' => '3306',
407412
'socket' => $mysql::params::socket,
413+
'skip-ssl' => $skip_ssl,
408414
},
409415
'mysqld_safe' => {
410416
'nice' => '0',

spec/acceptance/types/mysql_database_spec.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
require 'spec_helper_acceptance'
44

55
describe 'mysql_database' do
6+
mysql_cmd = get_db_cmd
67
describe 'setup' do
78
pp = <<-MANIFEST
89
class { 'mysql::server': }
@@ -25,7 +26,7 @@ class { 'mysql::server': }
2526
end
2627

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

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

5758
it 'finds utf8 db #stdout' do
58-
run_shell("mysql -NBe \"SHOW VARIABLES LIKE '%_database'\" spec_utf8") do |r|
59+
run_shell("#{mysql_cmd} -NBe \"SHOW VARIABLES LIKE '%_database'\" spec_utf8") do |r|
5960
expect(r.stdout).to match(%r{^character_set_database\tutf8(mb3)?\ncollation_database\tutf8(mb3)?_general_ci$})
6061
expect(r.stderr).to be_empty
6162
end

spec/acceptance/types/mysql_grant_spec.rb

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
require 'spec_helper_acceptance'
44

55
describe 'mysql_grant' do
6+
mysql_cmd = get_db_cmd
7+
68
before(:all) do
79
pp = <<-MANIFEST
810
class { 'mysql::server':
@@ -31,7 +33,7 @@ class { 'mysql::server':
3133
end
3234

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

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

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

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

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

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

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

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

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

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

263265
it 'finds short ipv6 #stdout' do
264-
run_shell("mysql -NBe \"SHOW GRANTS FOR 'test'@'::1/128'\"") do |r|
266+
run_shell("#{mysql_cmd} -NBe \"SHOW GRANTS FOR 'test'@'::1/128'\"") do |r|
265267
expect(r.stdout).to match(%r{GRANT ALL PRIVILEGES ON ['|`]test['|`].* TO ['|`]test['|`]@['|`]::1/128['|`]})
266268
expect(r.stderr).to be_empty
267269
end
@@ -279,9 +281,9 @@ class { 'mysql::server':
279281
}
280282
281283
exec { 'mysql-create-table':
282-
command => '/usr/bin/mysql -NBe "CREATE TABLE foo.bar (name VARCHAR(20))"',
284+
command => '/usr/bin/#{mysql_cmd} -NBe "CREATE TABLE foo.bar (name VARCHAR(20))"',
283285
environment => "HOME=${::root_home}",
284-
unless => '/usr/bin/mysql -NBe "SELECT 1 FROM foo.bar LIMIT 1;"',
286+
unless => '/usr/bin/#{mysql_cmd} -NBe "SELECT 1 FROM foo.bar LIMIT 1;"',
285287
require => Mysql_database['foo'],
286288
}
287289
@@ -387,7 +389,7 @@ class { 'mysql::server':
387389
describe 'adding procedure privileges' do
388390
pp = <<-MANIFEST
389391
exec { 'simpleproc-create':
390-
command => 'mysql --user="root" --password="password" --database=mysql --delimiter="//" -NBe "CREATE PROCEDURE simpleproc (OUT param1 INT) BEGIN SELECT COUNT(*) INTO param1 FROM t; end//"',
392+
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//\\"",
391393
path => '/usr/bin/',
392394
before => Mysql_user['test2@tester'],
393395
}
@@ -407,7 +409,7 @@ class { 'mysql::server':
407409
end
408410

409411
it 'finds the user #stdout' do
410-
result = run_shell('mysql -NBe "SHOW GRANTS FOR test2@tester"')
412+
result = run_shell("#{mysql_cmd} -NBe \"SHOW GRANTS FOR test2@tester\"")
411413
expect(result.stdout).to match(%r{GRANT EXECUTE ON PROCEDURE `mysql`.`simpleproc` TO ['|`]test2['|`]@['|`]tester['|`]})
412414
expect(result.stderr).to be_empty
413415
end
@@ -417,7 +419,7 @@ class { 'mysql::server':
417419
it 'works without errors' do
418420
pp = <<-MANIFEST
419421
exec { 'simplefunc-create':
420-
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, \\'!\\')"',
422+
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, '!')\\"",
421423
before => Mysql_user['test3@tester'],
422424
}
423425
@@ -438,7 +440,7 @@ class { 'mysql::server':
438440
end
439441

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

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

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

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

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

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

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

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

696698
it 'has the table' do
697-
result = run_shell("mysql -e 'show tables;' grant_spec_db|grep grant_spec_table")
699+
result = run_shell("#{mysql_cmd} -e 'show tables;' grant_spec_db|grep grant_spec_table")
698700
expect(result.exit_code).to be_zero
699701
end
700702
end

0 commit comments

Comments
 (0)