Skip to content

mysqlbackup.sh should be able to find mysql #457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 10, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions manifests/server/backup.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
$ensure = 'present',
$time = ['23', '5'],
$postscript = false,
$execpath = '/usr/bin:/usr/sbin:/bin:/sbin',
) {

mysql_user { "${backupuser}@localhost":
Expand Down
1 change: 1 addition & 0 deletions spec/acceptance/mysql_backup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class { 'mysql::server::backup':
'cp -r /tmp/backups /var/tmp/mysqlbackups',
'touch /var/tmp/mysqlbackups.done',
],
execpath => '/usr/bin:/usr/sbin:/bin:/sbin:/opt/zimbra/bin',
}
EOS

Expand Down
5 changes: 5 additions & 0 deletions spec/classes/mysql_server_backup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
'backupdir' => '/tmp',
'backuprotate' => '25',
'delete_before_dump' => true,
'execpath' => '/usr/bin:/usr/sbin:/bin:/sbin:/opt/zimbra/bin',
}
}
context 'standard conditions' do
Expand Down Expand Up @@ -51,6 +52,10 @@
# 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
Expand Down
2 changes: 1 addition & 1 deletion templates/mysqlbackup.sh.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ EVENTS="--events"
<% end %>

##### STOP CONFIG ####################################################
PATH=/usr/bin:/usr/sbin:/bin:/sbin
PATH=<%= @execpath %>



Expand Down