Use double quotes for mysql backup

Previously we were trying to run a mysql backup before we attempted
migrations, just in case something went wrong. However, the command
was failing because the $db_name variable wasn't being properly
interpolated. This commit fixes that by using " around the command
instead of '. Additionally, pipefail is set on the exec to prevent
this from succeeding but not working in the future.

Change-Id: I746a9f0ae722802419f36f80626c3a6f4186bad6
This commit is contained in:
Matthew Treinish 2015-10-09 12:10:01 -04:00
parent ab6e196aa4
commit 1cd42a389f
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177
1 changed files with 1 additions and 1 deletions

View File

@ -41,7 +41,7 @@ class subunit2sql::server (
}
exec { 'backup_subunit2sql_db':
command => 'mysqldump --defaults-file=/etc/subunit2sql-my.cnf --opt $db_name | gzip -9 > /opt/subunit2sql.sql.gz',
command => "set -o pipefail; mysqldump --defaults-file=/etc/subunit2sql-my.cnf --opt ${db_name} | gzip -9 > /opt/subunit2sql.sql.gz",
path => '/usr/local/bin:/usr/bin:/bin/',
subscribe => Package['subunit2sql'],
require => File['/etc/subunit2sql-my.cnf'],