Skip to content

Commit af65712

Browse files
committed
Test simpler regex and make template code simpler puppetlabs#1480
1 parent cc6aed2 commit af65712

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

spec/classes/mysql_backup_mysqldump_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class { 'mysql::server': }
8282

8383
it {
8484
is_expected.to contain_file('mysqlbackup.sh').with_content(
85-
%r{grep -v.*information_schema},
85+
%r{information_schema},
8686
)
8787
}
8888
end

templates/mysqlbackup.sh.erb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ cleanup
8181
<% end -%>
8282
<% if @backupdatabases.empty? -%>
8383
<% if @file_per_database -%>
84-
mysql --defaults-extra-file=$TMPFILE -s -r -N -e 'SHOW DATABASES' <% if ! @excludedatabases.empty? %> | grep -v '^\(<% @excludedatabases.join('|') %>\)$' <% end %> | while read dbname
84+
<% if @excludedatabases.empty? -%>
85+
mysql --defaults-extra-file=$TMPFILE -s -r -N -e 'SHOW DATABASES' | while read dbname
86+
<% else -%>
87+
mysql --defaults-extra-file=$TMPFILE -s -r -N -e 'SHOW DATABASES' | grep -v '^\(<% @excludedatabases.join('|') %>\)$' | while read dbname
88+
<% end -%>
8589
do
8690
<%= @backupmethod -%> --defaults-extra-file=$TMPFILE --opt --flush-logs --single-transaction \
8791
${ADDITIONAL_OPTIONS} \

0 commit comments

Comments
 (0)