Skip to content

Commit 8510a41

Browse files
committed
fixed character-set detection regex
Previous regex matched COLLATE value instead of CHARACTER SET. For example: > CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_bin */ Returned utf8_bin instead of utf8 causing an unfortunate database refresh in my configuration. Fixed the regex by adding the optional presence of the COLLATE keyword.
1 parent af4b8bf commit 8510a41

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/puppet/provider/database/mysql.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def destroy
2222
end
2323

2424
def charset
25-
mysql("--defaults-file=#{Facter.value(:root_home)}/.my.cnf", '-NBe', "show create database `#{resource[:name]}`").match(/.*?(\S+)\s\*\//)[1]
25+
mysql("--defaults-file=#{Facter.value(:root_home)}/.my.cnf", '-NBe', "show create database `#{resource[:name]}`").match(/.*?(\S+)\s(?:COLLATE.*)?\*\//)[1]
2626
end
2727

2828
def charset=(value)

0 commit comments

Comments
 (0)