Skip to content

Support for optional__args and prescript to mysqldump backup provider #1083

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
May 23, 2018
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
2 changes: 1 addition & 1 deletion manifests/server/backup.pp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
# @param maxallowedpacket
# Defines the maximum SQL statement size for the backup dump script. The default value is 1MB, as this is the default MySQL Server value.
# @param optional_args
# Specifies an array of optional arguments which should be passed through to the backup tool. (Currently only supported by the xtrabackup provider.)
# Specifies an array of optional arguments which should be passed through to the backup tool. (Supported by the xtrabackup and mysqldump providers.)
#
class mysql::server::backup (
$backupuser = undef,
Expand Down
11 changes: 11 additions & 0 deletions templates/mysqlbackup.sh.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ echo "[client]\npassword=$PASS\nuser=$USER\nmax_allowed_packet=$MAX_ALLOWED_PACK
echo -e "[client]\npassword=$PASS\nuser=$USER\nmax_allowed_packet=$MAX_ALLOWED_PACKET" > $TMPFILE
<%- end -%>

<% if @prescript -%>
<%- [@prescript].flatten.compact.each do |script|%>
<%= script %>
<%- end -%>
<% end -%>

# Ensure backup directory exist.
mkdir -p $DIR
Expand All @@ -54,6 +59,12 @@ ADDITIONAL_OPTIONS="$ADDITIONAL_OPTIONS --skip-routines"
<% end -%>
<% end -%>

<%- if @optional_args and @optional_args.is_a?(Array) -%>
<%- @optional_args.each do |arg| -%>
ADDITIONAL_OPTIONS="$ADDITIONAL_OPTIONS <%= arg %>"
<%- end -%>
<%- end -%>

##### STOP CONFIG ####################################################
PATH=<%= @execpath %>

Expand Down