Skip to content

Commit 4f0ea63

Browse files
committed
fix xtrabackup target directory and related regressions
1 parent c04c1a6 commit 4f0ea63

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

manifests/backup/xtrabackup.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
'weekday' => '1-6',
6969
},
7070
false => {
71-
'directories' => "--target-dir=${backupdir}",
71+
'directories' => "--target-dir=${backupdir}/$(date +\\%F_\\%H-\\%M-\\%S)",
7272
'weekday' => '*',
7373
},
7474
}

spec/classes/mysql_backup_xtrabackup_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class { 'mysql::server': }
3131
is_expected.to contain_cron('xtrabackup-weekly')
3232
.with(
3333
ensure: 'present',
34-
command: '/usr/local/sbin/xtrabackup.sh --target-dir=/tmp --backup',
34+
command: '/usr/local/sbin/xtrabackup.sh --target-dir=/tmp/$(date +\%F_\%H-\%M-\%S) --backup',
3535
user: 'root',
3636
hour: '23',
3737
minute: '5',
@@ -88,7 +88,7 @@ class { 'mysql::server': }
8888
is_expected.to contain_cron('xtrabackup-weekly')
8989
.with(
9090
ensure: 'present',
91-
command: '/usr/local/sbin/xtrabackup.sh --target-dir=/tmp --backup --skip-ssl',
91+
command: '/usr/local/sbin/xtrabackup.sh --target-dir=/tmp/$(date +\%F_\%H-\%M-\%S) --backup --skip-ssl',
9292
user: 'root',
9393
hour: '23',
9494
minute: '5',
@@ -123,7 +123,7 @@ class { 'mysql::server': }
123123
it 'contains the daily cronjob with all weekdays' do
124124
is_expected.to contain_cron('xtrabackup-daily').with(
125125
ensure: 'present',
126-
command: '/usr/local/sbin/xtrabackup.sh --target-dir=/tmp --backup',
126+
command: '/usr/local/sbin/xtrabackup.sh --target-dir=/tmp/$(date +\%F_\%H-\%M-\%S) --backup',
127127
user: 'root',
128128
hour: '23',
129129
minute: '5',

templates/xtrabackup.sh.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ set -o pipefail
2626
cleanup()
2727
{
2828
<%- if @kernel == 'SunOS' -%>
29-
gfind "${DIR}/" -maxdepth 1 -type f -name "${PREFIX}*.sql*" -mtime +${ROTATE} -print0 | gxargs -0 -r rm -f
29+
gfind "${DIR}/" -mindepth 1 -maxdepth 1 -mtime +${ROTATE} -print0 | gxargs -0 -r rm -rf
3030
<%- else -%>
31-
find "${DIR}/" -maxdepth 1 -type f -name "${PREFIX}*.sql*" -mtime +${ROTATE} -print0 | xargs -0 -r rm -f
31+
find "${DIR}/" -mindepth 1 -maxdepth 1 -mtime +${ROTATE} -print0 | xargs -0 -r rm -rf
3232
<%- end -%>
3333
}
3434

0 commit comments

Comments
 (0)