Skip to content

Commit 61c5372

Browse files
committed
Merge pull request #709 from cyberious/master
(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
2 parents 0305561 + 9dad94a commit 61c5372

File tree

3 files changed

+5
-19
lines changed

3 files changed

+5
-19
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ Whether or not to include routines for each database when doing a `file_per_data
385385

386386
#####`include_triggers`
387387

388-
Whether or not to include triggers for a each database when doing a `file_per_database` backup. Defaults to `true`.
388+
Whether or not to include triggers for a each database when doing a `file_per_database` backup. Defaults to `false`.
389389

390390
#####`ensure`
391391

manifests/backup/mysqldump.pp

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
$delete_before_dump = false,
1313
$backupdatabases = [],
1414
$file_per_database = false,
15-
$include_triggers = true,
15+
$include_triggers = false,
1616
$include_routines = false,
1717
$ensure = 'present',
1818
$time = ['23', '5'],
@@ -26,7 +26,7 @@
2626
require => Class['mysql::server::root_password'],
2727
}
2828

29-
if $include_triggers and versioncmp($::mysql_version, '5.1.5') > 0 {
29+
if $include_triggers {
3030
$privs = [ 'SELECT', 'RELOAD', 'LOCK TABLES', 'SHOW VIEW', 'PROCESS', 'TRIGGER' ]
3131
} else {
3232
$privs = [ 'SELECT', 'RELOAD', 'LOCK TABLES', 'SHOW VIEW', 'PROCESS' ]

spec/classes/mysql_server_backup_spec.rb

+2-16
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
on_pe_supported_platforms(PLATFORMS).each do |pe_version,pe_platforms|
55
pe_platforms.each do |pe_platform,facts|
66
describe "on #{pe_version} #{pe_platform}" do
7-
let(:facts) { {'mysql_version' => '5.1.6'}.merge(facts) }
7+
let(:facts) { facts }
88

99
let(:default_params) {
1010
{ 'backupuser' => 'testuser',
@@ -26,12 +26,7 @@
2626
it { is_expected.to contain_mysql_grant('testuser@localhost/*.*').with(
2727
:privileges => ['SELECT', 'RELOAD', 'LOCK TABLES', 'SHOW VIEW', 'PROCESS', 'TRIGGER']
2828
).that_requires('Mysql_user[testuser@localhost]') }
29-
context 'mysql < 5.1.6' do
30-
let(:facts) { {'mysql_version' => '5.0.95'}.merge(facts) }
31-
it { is_expected.to contain_mysql_grant('testuser@localhost/*.*').with(
32-
:privileges => ['SELECT', 'RELOAD', 'LOCK TABLES', 'SHOW VIEW', 'PROCESS']
33-
).that_requires('Mysql_user[testuser@localhost]') }
34-
end
29+
3530
context 'with triggers excluded' do
3631
let(:params) do
3732
{ :include_triggers => false }.merge(default_params)
@@ -280,15 +275,6 @@
280275
/ADDITIONAL_OPTIONS="\$ADDITIONAL_OPTIONS --triggers"/
281276
)
282277
end
283-
describe 'mysql_version < 5.0.11' do
284-
let(:facts) { facts.merge({'mysql_version' => '5.0.10'}) }
285-
it 'should backup triggers when asked' do
286-
is_expected.to contain_file('mysqlbackup.sh').with_content(
287-
/ADDITIONAL_OPTIONS="\$ADDITIONAL_OPTIONS --triggers"/
288-
)
289-
end
290-
end
291-
292278
end
293279

294280
context 'with include_triggers set to false' do

0 commit comments

Comments
 (0)