Skip to content

Commit fdc910c

Browse files
authored
Merge pull request #1083 from eputnam/markleary-master
Support for optional__args and prescript to mysqldump backup provider
2 parents 61646f2 + 1883f91 commit fdc910c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

manifests/server/backup.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
# @param maxallowedpacket
5454
# Defines the maximum SQL statement size for the backup dump script. The default value is 1MB, as this is the default MySQL Server value.
5555
# @param optional_args
56-
# Specifies an array of optional arguments which should be passed through to the backup tool. (Currently only supported by the xtrabackup provider.)
56+
# Specifies an array of optional arguments which should be passed through to the backup tool. (Supported by the xtrabackup and mysqldump providers.)
5757
#
5858
class mysql::server::backup (
5959
$backupuser = undef,

templates/mysqlbackup.sh.erb

+11
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ echo "[client]\npassword=$PASS\nuser=$USER\nmax_allowed_packet=$MAX_ALLOWED_PACK
2828
echo -e "[client]\npassword=$PASS\nuser=$USER\nmax_allowed_packet=$MAX_ALLOWED_PACKET" > $TMPFILE
2929
<%- end -%>
3030

31+
<% if @prescript -%>
32+
<%- [@prescript].flatten.compact.each do |script|%>
33+
<%= script %>
34+
<%- end -%>
35+
<% end -%>
3136

3237
# Ensure backup directory exist.
3338
mkdir -p $DIR
@@ -54,6 +59,12 @@ ADDITIONAL_OPTIONS="$ADDITIONAL_OPTIONS --skip-routines"
5459
<% end -%>
5560
<% end -%>
5661

62+
<%- if @optional_args and @optional_args.is_a?(Array) -%>
63+
<%- @optional_args.each do |arg| -%>
64+
ADDITIONAL_OPTIONS="$ADDITIONAL_OPTIONS <%= arg %>"
65+
<%- end -%>
66+
<%- end -%>
67+
5768
##### STOP CONFIG ####################################################
5869
PATH=<%= @execpath %>
5970

0 commit comments

Comments
 (0)