Skip to content

xtrabackup.sh only touch when backup_success_file_path is set #1522

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 2 commits into from
Jan 9, 2023
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
18 changes: 18 additions & 0 deletions spec/classes/mysql_backup_xtrabackup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ class { 'mysql::server': }
default_params
end

it 'does not contain the touch command' do
is_expected.to contain_file('xtrabackup.sh').without_content(
%r{(^\s+touch\s+$)},
)
end

it 'contains the wrapper script' do
is_expected.to contain_file('xtrabackup.sh').with_content(
%r{(\n*^xtrabackup\s+.*\$@)},
Expand Down Expand Up @@ -304,6 +310,18 @@ class { 'mysql::server': }
)
end
end

context 'with backup_success_file_path' do
let(:params) do
{ backup_success_file_path: '/tmp/backup_success' }.merge(default_params)
end

it 'contain the touch /tmp/backup_success command' do
is_expected.to contain_file('xtrabackup.sh').with_content(
%r{(^\s+touch /tmp/backup_success$)},
)
end
end
end
end
# rubocop:enable RSpec/NestedGroups
Expand Down
2 changes: 2 additions & 0 deletions templates/xtrabackup.sh.erb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ cleanup
<% unless @delete_before_dump -%>
if [ $? -eq 0 ] ; then
cleanup
<% if @backup_success_file_path -%>
touch <%= @backup_success_file_path %>
<% end -%>
fi
<% end -%>

Expand Down