diff --git a/manifests/params.pp b/manifests/params.pp index c53c4f6cd..87c71fba9 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -401,10 +401,16 @@ } } + $skip_ssl = $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', diff --git a/spec/acceptance/types/mysql_database_spec.rb b/spec/acceptance/types/mysql_database_spec.rb index eb10136fc..eb10a4198 100644 --- a/spec/acceptance/types/mysql_database_spec.rb +++ b/spec/acceptance/types/mysql_database_spec.rb @@ -25,7 +25,7 @@ class { 'mysql::server': } end it 'finds the database #stdout' do - run_shell("mysql -NBe \"SHOW DATABASES LIKE 'spec_db'\"") do |r| + run_shell("mariadb -NBe \"SHOW DATABASES LIKE 'spec_db'\"") do |r| expect(r.stdout).to match(%r{^spec_db$}) expect(r.stderr).to be_empty end @@ -48,14 +48,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("mariadb -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("mariadb -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 diff --git a/spec/acceptance/types/mysql_grant_spec.rb b/spec/acceptance/types/mysql_grant_spec.rb index f5ab590c2..52ba83022 100644 --- a/spec/acceptance/types/mysql_grant_spec.rb +++ b/spec/acceptance/types/mysql_grant_spec.rb @@ -31,7 +31,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('mariadb -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 @@ -53,7 +53,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('mariadb -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 @@ -76,7 +76,7 @@ class { 'mysql::server': end it 'finds the user #stdout' do - result = run_shell('mysql -NBe "SHOW GRANTS FOR test2@tester"') + result = run_shell('mariadb -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 @@ -100,7 +100,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("mariadb -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 @@ -125,7 +125,7 @@ class { 'mysql::server': end it 'finds the user #stdout' do - result = run_shell('mysql -NBe "SHOW GRANTS FOR test3@tester"') + result = run_shell('mariadb -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 @@ -169,7 +169,7 @@ class { 'mysql::server': end it 'finds the user #stdout' do - result = run_shell('mysql -NBe "SHOW GRANTS FOR test4@tester"') + result = run_shell('mariadb -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 @@ -234,34 +234,34 @@ class { 'mysql::server': end it 'finds short hostname #stdout' do - result = run_shell('mysql -NBe "SHOW GRANTS FOR test@short"') + result = run_shell('mariadb -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("mariadb -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("mariadb -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("mariadb -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("mariadb -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 @@ -279,9 +279,9 @@ class { 'mysql::server': } exec { 'mysql-create-table': - command => '/usr/bin/mysql -NBe "CREATE TABLE foo.bar (name VARCHAR(20))"', + command => '/usr/bin/mariadb -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/mariadb -NBe "SELECT 1 FROM foo.bar LIMIT 1;"', require => Mysql_database['foo'], } @@ -387,7 +387,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 => 'mariadb --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'], } @@ -407,7 +407,7 @@ class { 'mysql::server': end it 'finds the user #stdout' do - result = run_shell('mysql -NBe "SHOW GRANTS FOR test2@tester"') + result = run_shell('mariadb -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 @@ -417,7 +417,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/mariadb --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'], } @@ -438,7 +438,7 @@ class { 'mysql::server': end it 'finds the user' do - result = run_shell('mysql -NBe "SHOW GRANTS FOR test3@tester"') + result = run_shell('mariadb -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 @@ -463,7 +463,7 @@ class { 'mysql::server': end it 'finds the user #stdout' do - run_shell('mysql -NBe "SHOW GRANTS FOR proxy1@tester"') do |r| + run_shell('mariadb -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 @@ -488,7 +488,7 @@ class { 'mysql::server': end it 'finds the user #stdout' do - run_shell('mysql -NBe "SHOW GRANTS FOR proxy1@tester"') do |r| + run_shell('mariadb -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 @@ -514,7 +514,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('mariadb -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 @@ -538,7 +538,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('mariadb -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 @@ -562,7 +562,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('mariadb -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 @@ -609,13 +609,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 test@fqdn.com"', expect_failures: true) + result = run_shell('mariadb -NBe "SHOW GRANTS FOR test@fqdn.com"', 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("mariadb -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 @@ -694,7 +694,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("mariadb -e 'show tables;' grant_spec_db|grep grant_spec_table") expect(result.exit_code).to be_zero end end diff --git a/spec/acceptance/types/mysql_user_spec.rb b/spec/acceptance/types/mysql_user_spec.rb index 2d7412175..d787dd342 100644 --- a/spec/acceptance/types/mysql_user_spec.rb +++ b/spec/acceptance/types/mysql_user_spec.rb @@ -31,14 +31,14 @@ class { 'mysql::server': * => $ed25519_opts } end it 'finds the user #stdout' do - run_shell("mysql -NBe \"select '1' from mysql.user where CONCAT(user, '@', host) = 'ashp@localhost'\"") do |r| + run_shell("mariadb -NBe \"select '1' from mysql.user where CONCAT(user, '@', host) = 'ashp@localhost'\"") do |r| expect(r.stdout).to match(%r{^1$}) expect(r.stderr).to be_empty end end it 'has no SSL options #stdout' do - run_shell("mysql -NBe \"select SSL_TYPE from mysql.user where CONCAT(user, '@', host) = 'ashp@localhost'\"") do |r| + run_shell("mariadb -NBe \"select SSL_TYPE from mysql.user where CONCAT(user, '@', host) = 'ashp@localhost'\"") do |r| expect(r.stdout).to match(%r{^\s*$}) expect(r.stderr).to be_empty end @@ -57,7 +57,7 @@ class { 'mysql::server': * => $ed25519_opts } end it 'has the correct plugin', if: (os[:family] != 'sles' && os[:release].to_i == 15) do - run_shell("mysql -NBe \"select plugin from mysql.user where CONCAT(user, '@', host) = 'ashp@localhost'\"") do |r| + run_shell("mariadb -NBe \"select plugin from mysql.user where CONCAT(user, '@', host) = 'ashp@localhost'\"") do |r| expect(r.stdout.rstrip).to eq('auth_socket') expect(r.stderr).to be_empty end @@ -69,7 +69,7 @@ class { 'mysql::server': * => $ed25519_opts } else 'password' end - run_shell("mysql -NBe \"select #{table} from mysql.user where CONCAT(user, '@', host) = 'ashp@localhost'\"") do |r| + run_shell("mariadb -NBe \"select #{table} from mysql.user where CONCAT(user, '@', host) = 'ashp@localhost'\"") do |r| expect(r.stdout.rstrip).to be_empty expect(r.stderr).to be_empty end @@ -89,7 +89,7 @@ class { 'mysql::server': * => $ed25519_opts } end it 'has the correct plugin' do - run_shell("mysql -NBe \"select plugin from mysql.user where CONCAT(user, '@', host) = 'ashp@localhost'\"") do |r| + run_shell("mariadb -NBe \"select plugin from mysql.user where CONCAT(user, '@', host) = 'ashp@localhost'\"") do |r| expect(r.stdout.rstrip).to eq('ed25519') expect(r.stderr).to be_empty end @@ -109,7 +109,7 @@ class { 'mysql::server': * => $ed25519_opts } end it 'finds the user #stdout' do - run_shell("mysql -NBe \"select '1' from mysql.user where CONCAT(user, '@', host) = 'ashp-dash@localhost'\"") do |r| + run_shell("mariadb -NBe \"select '1' from mysql.user where CONCAT(user, '@', host) = 'ashp-dash@localhost'\"") do |r| expect(r.stdout).to match(%r{^1$}) expect(r.stderr).to be_empty end @@ -129,7 +129,7 @@ class { 'mysql::server': * => $ed25519_opts } end it 'finds the user #stdout' do - run_shell("mysql -NBe \"select '1' from mysql.user where CONCAT(user, '@', host) = 'ashp@localhost'\"") do |r| + run_shell("mariadb -NBe \"select '1' from mysql.user where CONCAT(user, '@', host) = 'ashp@localhost'\"") do |r| expect(r.stdout).to match(%r{^1$}) expect(r.stderr).to be_empty end @@ -160,14 +160,14 @@ class { 'mysql::server': * => $ed25519_opts } end it 'finds the user #stdout' do - run_shell("mysql -NBe \"select '1' from mysql.user where CONCAT(user, '@', host) = 'user-w-ssl@localhost'\"") do |r| + run_shell("mariadb -NBe \"select '1' from mysql.user where CONCAT(user, '@', host) = 'user-w-ssl@localhost'\"") do |r| expect(r.stdout).to match(%r{^1$}) expect(r.stderr).to be_empty end end it 'shows correct ssl_type #stdout' do - run_shell("mysql -NBe \"select SSL_TYPE from mysql.user where CONCAT(user, '@', host) = 'user-w-ssl@localhost'\"") do |r| + run_shell("mariadb -NBe \"select SSL_TYPE from mysql.user where CONCAT(user, '@', host) = 'user-w-ssl@localhost'\"") do |r| expect(r.stdout).to match(%r{^ANY$}) expect(r.stderr).to be_empty end @@ -188,14 +188,14 @@ class { 'mysql::server': * => $ed25519_opts } end it 'finds the user #stdout' do - run_shell("mysql -NBe \"select '1' from mysql.user where CONCAT(user, '@', host) = 'user-w-x509@localhost'\"") do |r| + run_shell("mariadb -NBe \"select '1' from mysql.user where CONCAT(user, '@', host) = 'user-w-x509@localhost'\"") do |r| expect(r.stdout).to match(%r{^1$}) expect(r.stderr).to be_empty end end it 'shows correct ssl_type #stdout' do - run_shell("mysql -NBe \"select SSL_TYPE from mysql.user where CONCAT(user, '@', host) = 'user-w-x509@localhost'\"") do |r| + run_shell("mariadb -NBe \"select SSL_TYPE from mysql.user where CONCAT(user, '@', host) = 'user-w-x509@localhost'\"") do |r| expect(r.stdout).to match(%r{^X509$}) expect(r.stderr).to be_empty end @@ -219,35 +219,35 @@ class { 'mysql::server': * => $ed25519_opts } end it 'finds the user #stdout' do - run_shell("mysql -NBe \"select '1' from mysql.user where CONCAT(user, '@', host) = 'user-w-subject@localhost'\"") do |r| + run_shell("mariadb -NBe \"select '1' from mysql.user where CONCAT(user, '@', host) = 'user-w-subject@localhost'\"") do |r| expect(r.stdout).to match(%r{^1$}) expect(r.stderr).to be_empty end end it 'shows correct ssl_type #stdout' do - run_shell("mysql -NBe \"select SSL_TYPE from mysql.user where CONCAT(user, '@', host) = 'user-w-subject@localhost'\"") do |r| + run_shell("mariadb -NBe \"select SSL_TYPE from mysql.user where CONCAT(user, '@', host) = 'user-w-subject@localhost'\"") do |r| expect(r.stdout).to match(%r{^SPECIFIED$}) expect(r.stderr).to be_empty end end it 'shows correct x509_issuer #stdout' do - run_shell("mysql -NBe \"select X509_ISSUER from mysql.user where CONCAT(user, '@', host) = 'user-w-subject@localhost'\"") do |r| + run_shell("mariadb -NBe \"select X509_ISSUER from mysql.user where CONCAT(user, '@', host) = 'user-w-subject@localhost'\"") do |r| expect(r.stdout).to match(%r{^/CN=Certificate Authority$}) expect(r.stderr).to be_empty end end it 'shows correct x509_subject #stdout' do - run_shell("mysql -NBe \"select X509_SUBJECT from mysql.user where CONCAT(user, '@', host) = 'user-w-subject@localhost'\"") do |r| + run_shell("mariadb -NBe \"select X509_SUBJECT from mysql.user where CONCAT(user, '@', host) = 'user-w-subject@localhost'\"") do |r| expect(r.stdout).to match(%r{^/OU=MySQL Users/CN=username$}) expect(r.stderr).to be_empty end end it 'shows correct ssl_cipher #stdout' do - run_shell("mysql -NBe \"select SSL_CIPHER from mysql.user where CONCAT(user, '@', host) = 'user-w-subject@localhost'\"") do |r| + run_shell("mariadb -NBe \"select SSL_CIPHER from mysql.user where CONCAT(user, '@', host) = 'user-w-subject@localhost'\"") do |r| expect(r.stdout).to match(%r{^EDH-RSA-DES-CBC3-SHA$}) expect(r.stderr).to be_empty end