diff --git a/README.md b/README.md index bf5508f..67692c6 100644 --- a/README.md +++ b/README.md @@ -385,7 +385,7 @@ Whether or not to include routines for each database when doing a `file_per_data #####`include_triggers` -Whether or not to include triggers for a each database when doing a `file_per_database` backup. Defaults to `true`. +Whether or not to include triggers for a each database when doing a `file_per_database` backup. Defaults to `false`. #####`ensure` diff --git a/manifests/backup/mysqldump.pp b/manifests/backup/mysqldump.pp index 28d2eeb..77d5e39 100644 --- a/manifests/backup/mysqldump.pp +++ b/manifests/backup/mysqldump.pp @@ -12,7 +12,7 @@ class mysql::backup::mysqldump ( $delete_before_dump = false, $backupdatabases = [], $file_per_database = false, - $include_triggers = true, + $include_triggers = false, $include_routines = false, $ensure = 'present', $time = ['23', '5'], @@ -26,7 +26,7 @@ class mysql::backup::mysqldump ( require => Class['mysql::server::root_password'], } - if $include_triggers and versioncmp($::mysql_version, '5.1.5') > 0 { + if $include_triggers { $privs = [ 'SELECT', 'RELOAD', 'LOCK TABLES', 'SHOW VIEW', 'PROCESS', 'TRIGGER' ] } else { $privs = [ 'SELECT', 'RELOAD', 'LOCK TABLES', 'SHOW VIEW', 'PROCESS' ] diff --git a/spec/classes/mysql_server_backup_spec.rb b/spec/classes/mysql_server_backup_spec.rb index f811ed7..81abb30 100644 --- a/spec/classes/mysql_server_backup_spec.rb +++ b/spec/classes/mysql_server_backup_spec.rb @@ -4,7 +4,7 @@ describe 'mysql::server::backup' do on_pe_supported_platforms(PLATFORMS).each do |pe_version,pe_platforms| pe_platforms.each do |pe_platform,facts| describe "on #{pe_version} #{pe_platform}" do - let(:facts) { {'mysql_version' => '5.1.6'}.merge(facts) } + let(:facts) { facts } let(:default_params) { { 'backupuser' => 'testuser', @@ -26,12 +26,7 @@ describe 'mysql::server::backup' do it { is_expected.to contain_mysql_grant('testuser@localhost/*.*').with( :privileges => ['SELECT', 'RELOAD', 'LOCK TABLES', 'SHOW VIEW', 'PROCESS', 'TRIGGER'] ).that_requires('Mysql_user[testuser@localhost]') } - context 'mysql < 5.1.6' do - let(:facts) { {'mysql_version' => '5.0.95'}.merge(facts) } - it { is_expected.to contain_mysql_grant('testuser@localhost/*.*').with( - :privileges => ['SELECT', 'RELOAD', 'LOCK TABLES', 'SHOW VIEW', 'PROCESS'] - ).that_requires('Mysql_user[testuser@localhost]') } - end + context 'with triggers excluded' do let(:params) do { :include_triggers => false }.merge(default_params) @@ -280,15 +275,6 @@ describe 'mysql::server::backup' do /ADDITIONAL_OPTIONS="\$ADDITIONAL_OPTIONS --triggers"/ ) end - describe 'mysql_version < 5.0.11' do - let(:facts) { facts.merge({'mysql_version' => '5.0.10'}) } - it 'should backup triggers when asked' do - is_expected.to contain_file('mysqlbackup.sh').with_content( - /ADDITIONAL_OPTIONS="\$ADDITIONAL_OPTIONS --triggers"/ - ) - end - end - end context 'with include_triggers set to false' do