Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #709 from cyberious/master
Browse files Browse the repository at this point in the history
(fix) - Fix issue where fact is unknown at start - Resolve issue where if known and failed versioncmp would result in idempotency issue on second run
hunner committed May 11, 2015

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
2 parents 0305561 + 9dad94a commit 61c5372
Showing 3 changed files with 5 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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`

4 changes: 2 additions & 2 deletions manifests/backup/mysqldump.pp
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
$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 @@
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' ]
18 changes: 2 additions & 16 deletions spec/classes/mysql_server_backup_spec.rb
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
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 @@
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 @@
/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

0 comments on commit 61c5372

Please sign in to comment.