From e56606d2c51a834462a1c840a0aa9f5bb79a6780 Mon Sep 17 00:00:00 2001 From: Mark Leary Date: Wed, 22 Mar 2017 10:04:17 -0400 Subject: [PATCH 1/2] Add optional_args support in mysqldump provider. --- templates/mysqlbackup.sh.erb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/templates/mysqlbackup.sh.erb b/templates/mysqlbackup.sh.erb index 9a9df12d1..e944bd76e 100755 --- a/templates/mysqlbackup.sh.erb +++ b/templates/mysqlbackup.sh.erb @@ -54,6 +54,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 %> From 1883f911768466f1a852f45055c445b7c826860d Mon Sep 17 00:00:00 2001 From: Mark Leary Date: Wed, 22 Mar 2017 11:02:26 -0400 Subject: [PATCH 2/2] Add prescript support to mysqldump provider --- manifests/server/backup.pp | 2 +- templates/mysqlbackup.sh.erb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) 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 e944bd76e..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