mysqlbackup.sh should be able to find mysql

anywhere. This should enable use to use mysql::server::backup
idependantly, even if mysql is preinstalled, and preinstalled in non
standard locations
This commit is contained in:
Igor Galić 2014-02-20 17:17:41 +01:00
parent d2eea45749
commit d2b24e40d3
5 changed files with 12 additions and 1 deletions

View file

@ -313,6 +313,10 @@ Whether a separate file be used per database.
Allows you to remove the backup scripts. Can be 'present' or 'absent'.
#####`execpath`
Allows you to set a custom PATH should your mysql installation be non-standard places. Defaults to `/usr/bin:/usr/sbin:/bin:/sbin`
#####`time`
An array of two elements to set the backup time. Allows ['23', '5'] or ['3', '45'] for HH:MM times.

View file

@ -15,6 +15,7 @@ class mysql::server::backup (
$ensure = 'present',
$time = ['23', '5'],
$postscript = false,
$execpath = '/usr/bin:/usr/sbin:/bin:/sbin',
) {
mysql_user { "${backupuser}@localhost":

View file

@ -21,6 +21,7 @@ describe 'mysql::server::backup class' do
'cp -r /tmp/backups /var/tmp/mysqlbackups',
'touch /var/tmp/mysqlbackups.done',
],
execpath => '/usr/bin:/usr/sbin:/bin:/sbin:/opt/zimbra/bin',
}
EOS

View file

@ -8,6 +8,7 @@ describe 'mysql::server::backup' do
'backupdir' => '/tmp',
'backuprotate' => '25',
'delete_before_dump' => true,
'execpath' => '/usr/bin:/usr/sbin:/bin:/sbin:/opt/zimbra/bin',
}
}
context 'standard conditions' do
@ -51,6 +52,10 @@ describe 'mysql::server::backup' do
# MySQL counts from 0 I guess.
should contain_file('mysqlbackup.sh').with_content(/.*ROTATE=24.*/)
end
it 'should have a standard PATH' do
should contain_file('mysqlbackup.sh').with_content(%r{PATH=/usr/bin:/usr/sbin:/bin:/sbin:/opt/zimbra/bin})
end
end
context 'custom ownership and mode for backupdir' do

View file

@ -23,7 +23,7 @@ EVENTS="--events"
<% end %>
##### STOP CONFIG ####################################################
PATH=/usr/bin:/usr/sbin:/bin:/sbin
PATH=<%= @execpath %>