diff --git a/manifests/server/backup.pp b/manifests/server/backup.pp index 8c69d42ab..25bf0537a 100644 --- a/manifests/server/backup.pp +++ b/manifests/server/backup.pp @@ -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, diff --git a/templates/mysqlbackup.sh.erb b/templates/mysqlbackup.sh.erb index 9a9df12d1..0e2adafc7 100755 --- a/templates/mysqlbackup.sh.erb +++ b/templates/mysqlbackup.sh.erb @@ -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 @@ -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 %>