Skip to content

Commit 914407b

Browse files
committed
xtrabackup.sh only touch when backup_success_file_path is set
1 parent 3ffc926 commit 914407b

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

spec/classes/mysql_backup_xtrabackup_spec.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ class { 'mysql::server': }
2424
let(:params) do
2525
default_params
2626
end
27+
it 'does not contain the touch /tmp/backup_success command' do
28+
is_expected.to contain_file('xtrabackup.sh').without_content(
29+
%r{(^\s+touch\s+$)},
30+
)
31+
end
2732

2833
it 'contains the wrapper script' do
2934
is_expected.to contain_file('xtrabackup.sh').with_content(
@@ -304,6 +309,18 @@ class { 'mysql::server': }
304309
)
305310
end
306311
end
312+
313+
context 'with backup_success_file_path' do
314+
let(:params) do
315+
{ backup_success_file_path: '/tmp/backup_success' }.merge(default_params)
316+
end
317+
318+
it 'contain the touch /tmp/backup_success command' do
319+
is_expected.to contain_file('xtrabackup.sh').with_content(
320+
%r{(^\s+touch /tmp/backup_success$)},
321+
)
322+
end
323+
end
307324
end
308325
end
309326
# rubocop:enable RSpec/NestedGroups

templates/xtrabackup.sh.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ cleanup
5959
<% unless @delete_before_dump -%>
6060
if [ $? -eq 0 ] ; then
6161
cleanup
62+
<% if @backup_success_file_path -%>
6263
touch <%= @backup_success_file_path %>
64+
<% end -%>
6365
fi
6466
<% end -%>
6567

0 commit comments

Comments
 (0)