Skip to content

Commit 2f247a8

Browse files
committed
Remove mysql_table_exists() function
This function is intended to check for the existence of a table before declaring some resource, but this is neither portable (because functions orun on the master, not the agent) nor one-run idempotent (because the function would run before mysql is even installed, and would take two runs to do anything). The correct way of doing this would be to update the providers and dependency ordering to handle the conditional states. Luckily this was never released so it is backwards compatible.
1 parent 1835ea8 commit 2f247a8

File tree

3 files changed

+0
-86
lines changed

3 files changed

+0
-86
lines changed

lib/puppet/parser/functions/mysql_table_exists.rb

-30
This file was deleted.

spec/acceptance/types/mysql_grant_spec.rb

-30
Original file line numberDiff line numberDiff line change
@@ -434,19 +434,6 @@ class { 'mysql::server': override_options => { 'root_password' => 'password' } }
434434
expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/Table 'grant_spec_db\.grant_spec_table' doesn't exist/)
435435
end
436436

437-
it 'checks if table exists before grant' do
438-
pp = <<-EOS
439-
if mysql_table_exists('grant_spec_db.grant_spec_table') {
440-
mysql_grant { 'test@localhost/grant_spec_db.grant_spec_table':
441-
user => 'test@localhost',
442-
privileges => 'ALL',
443-
table => 'grant_spec_db.grant_spec_table',
444-
}
445-
}
446-
EOS
447-
apply_manifest(pp, :catch_changes => true)
448-
end
449-
450437
it 'creates table' do
451438
pp = <<-EOS
452439
file { '/tmp/grant_spec_table.sql':
@@ -467,22 +454,5 @@ class { 'mysql::server': override_options => { 'root_password' => 'password' } }
467454
it 'should have the table' do
468455
expect(shell("mysql -e 'show tables;' grant_spec_db|grep grant_spec_table").exit_code).to be_zero
469456
end
470-
471-
it 'checks if table exists before grant' do
472-
pp = <<-EOS
473-
if mysql_table_exists('grant_spec_db.grant_spec_table') {
474-
mysql_grant { 'test@localhost/grant_spec_db.grant_spec_table':
475-
user => 'test@localhost',
476-
privileges => ['SELECT'],
477-
table => 'grant_spec_db.grant_spec_table',
478-
}
479-
}
480-
EOS
481-
apply_manifest(pp, :catch_failures => true)
482-
apply_manifest(pp, :catch_changes => true)
483-
end
484-
485-
486457
end
487-
488458
end

spec/unit/puppet/functions/mysql_table_exists_spec.rb

-26
This file was deleted.

0 commit comments

Comments
 (0)