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
This commit is contained in:
Hunter Haugen 2015-05-11 10:29:10 -07:00
commit 61c53727c2
3 changed files with 5 additions and 19 deletions

View file

@ -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`

View file

@ -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' ]

View file

@ -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