From 59ad75e694cc7256b21b4336a2f5715f05c32fdc 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. --- README.md | 2 +- templates/mysqlbackup.sh.erb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 317ed2979..0ec524edb 100644 --- a/README.md +++ b/README.md @@ -598,7 +598,7 @@ Defines the maximum SQL statement size for the backup dump script. The default v ##### `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.) #### mysql::server::monitor 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 35af72a05e3924a0457e98b78199ebb46b6c9b7f 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 --- templates/mysqlbackup.sh.erb | 5 +++++ 1 file changed, 5 insertions(+) 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