Made the 'TRIGGER'privilege of mysqldump backups depend on whether or not we are actually backing up triggers
This commit is contained in:
parent
ec14b87a81
commit
49f273a42c
2 changed files with 25 additions and 6 deletions
|
@ -26,12 +26,22 @@ class mysql::backup::mysqldump (
|
||||||
require => Class['mysql::server::root_password'],
|
require => Class['mysql::server::root_password'],
|
||||||
}
|
}
|
||||||
|
|
||||||
mysql_grant { "${backupuser}@localhost/*.*":
|
if $include_triggers {
|
||||||
ensure => $ensure,
|
mysql_grant { "${backupuser}@localhost/*.*":
|
||||||
user => "${backupuser}@localhost",
|
ensure => $ensure,
|
||||||
table => '*.*',
|
user => "${backupuser}@localhost",
|
||||||
privileges => [ 'SELECT', 'RELOAD', 'LOCK TABLES', 'SHOW VIEW', 'PROCESS', 'TRIGGER' ],
|
table => '*.*',
|
||||||
require => Mysql_user["${backupuser}@localhost"],
|
privileges => [ 'SELECT', 'RELOAD', 'LOCK TABLES', 'SHOW VIEW', 'PROCESS', 'TRIGGER' ],
|
||||||
|
require => Mysql_user["${backupuser}@localhost"],
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mysql_grant { "${backupuser}@localhost/*.*":
|
||||||
|
ensure => $ensure,
|
||||||
|
user => "${backupuser}@localhost",
|
||||||
|
table => '*.*',
|
||||||
|
privileges => [ 'SELECT', 'RELOAD', 'LOCK TABLES', 'SHOW VIEW', 'PROCESS' ],
|
||||||
|
require => Mysql_user["${backupuser}@localhost"],
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cron { 'mysql-backup':
|
cron { 'mysql-backup':
|
||||||
|
|
|
@ -27,6 +27,15 @@ describe 'mysql::server::backup' do
|
||||||
:privileges => ['SELECT', 'RELOAD', 'LOCK TABLES', 'SHOW VIEW', 'PROCESS', 'TRIGGER']
|
:privileges => ['SELECT', 'RELOAD', 'LOCK TABLES', 'SHOW VIEW', 'PROCESS', 'TRIGGER']
|
||||||
).that_requires('Mysql_user[testuser@localhost]') }
|
).that_requires('Mysql_user[testuser@localhost]') }
|
||||||
|
|
||||||
|
context 'with triggers excluded' do
|
||||||
|
let(:params) do
|
||||||
|
{ :include_triggers => false }.merge(default_params)
|
||||||
|
end
|
||||||
|
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
|
||||||
|
|
||||||
it { is_expected.to contain_cron('mysql-backup').with(
|
it { is_expected.to contain_cron('mysql-backup').with(
|
||||||
:command => '/usr/local/sbin/mysqlbackup.sh',
|
:command => '/usr/local/sbin/mysqlbackup.sh',
|
||||||
:ensure => 'present'
|
:ensure => 'present'
|
||||||
|
|
Loading…
Reference in a new issue