Merge pull request #565 from mmonaco/master

mysql_database: prevent syntax error with collate=>'binary'
This commit is contained in:
Igor Galić 2014-09-16 13:34:44 +02:00
commit 86c7fcf28e
3 changed files with 7 additions and 2 deletions

View file

@ -31,7 +31,7 @@ Puppet::Type.type(:mysql_database).provide(:mysql, :parent => Puppet::Provider::
end
def create
mysql([defaults_file, '-NBe', "create database if not exists `#{@resource[:name]}` character set #{@resource[:charset]} collate #{@resource[:collate]}"].compact)
mysql([defaults_file, '-NBe', "create database if not exists `#{@resource[:name]}` character set `#{@resource[:charset]}` collate `#{@resource[:collate]}`"].compact)
@property_hash[:ensure] = :present
@property_hash[:charset] = @resource[:charset]

View file

@ -56,7 +56,7 @@ test
describe 'create' do
it 'makes a database' do
provider.expects(:mysql).with([defaults_file, '-NBe', "create database if not exists `#{resource[:name]}` character set #{resource[:charset]} collate #{resource[:collate]}"])
provider.expects(:mysql).with([defaults_file, '-NBe', "create database if not exists `#{resource[:name]}` character set `#{resource[:charset]}` collate `#{resource[:collate]}`"])
provider.expects(:exists?).returns(true)
expect(provider.create).to be_truthy
end

View file

@ -10,3 +10,8 @@ database{ 'test4':
ensure => present,
charset => 'latin1',
}
database{ 'test5':
ensure => present,
charset => 'binary',
collate => 'binary',
}