Skip to content

Commit d2b24e4

Browse files
committed
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
1 parent d2eea45 commit d2b24e4

File tree

5 files changed

+12
-1
lines changed

5 files changed

+12
-1
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,10 @@ Whether a separate file be used per database.
313313

314314
Allows you to remove the backup scripts. Can be 'present' or 'absent'.
315315

316+
#####`execpath`
317+
318+
Allows you to set a custom PATH should your mysql installation be non-standard places. Defaults to `/usr/bin:/usr/sbin:/bin:/sbin`
319+
316320
#####`time`
317321

318322
An array of two elements to set the backup time. Allows ['23', '5'] or ['3', '45'] for HH:MM times.

manifests/server/backup.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
$ensure = 'present',
1616
$time = ['23', '5'],
1717
$postscript = false,
18+
$execpath = '/usr/bin:/usr/sbin:/bin:/sbin',
1819
) {
1920

2021
mysql_user { "${backupuser}@localhost":

spec/acceptance/mysql_backup_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class { 'mysql::server::backup':
2121
'cp -r /tmp/backups /var/tmp/mysqlbackups',
2222
'touch /var/tmp/mysqlbackups.done',
2323
],
24+
execpath => '/usr/bin:/usr/sbin:/bin:/sbin:/opt/zimbra/bin',
2425
}
2526
EOS
2627

spec/classes/mysql_server_backup_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
'backupdir' => '/tmp',
99
'backuprotate' => '25',
1010
'delete_before_dump' => true,
11+
'execpath' => '/usr/bin:/usr/sbin:/bin:/sbin:/opt/zimbra/bin',
1112
}
1213
}
1314
context 'standard conditions' do
@@ -51,6 +52,10 @@
5152
# MySQL counts from 0 I guess.
5253
should contain_file('mysqlbackup.sh').with_content(/.*ROTATE=24.*/)
5354
end
55+
56+
it 'should have a standard PATH' do
57+
should contain_file('mysqlbackup.sh').with_content(%r{PATH=/usr/bin:/usr/sbin:/bin:/sbin:/opt/zimbra/bin})
58+
end
5459
end
5560

5661
context 'custom ownership and mode for backupdir' do

templates/mysqlbackup.sh.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ EVENTS="--events"
2323
<% end %>
2424

2525
##### STOP CONFIG ####################################################
26-
PATH=/usr/bin:/usr/sbin:/bin:/sbin
26+
PATH=<%= @execpath %>
2727

2828

2929

0 commit comments

Comments
 (0)