Merge pull request #565 from mmonaco/master
mysql_database: prevent syntax error with collate=>'binary'
This commit is contained in:
commit
86c7fcf28e
3 changed files with 7 additions and 2 deletions
|
@ -31,7 +31,7 @@ Puppet::Type.type(:mysql_database).provide(:mysql, :parent => Puppet::Provider::
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
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[:ensure] = :present
|
||||||
@property_hash[:charset] = @resource[:charset]
|
@property_hash[:charset] = @resource[:charset]
|
||||||
|
|
|
@ -56,7 +56,7 @@ test
|
||||||
|
|
||||||
describe 'create' do
|
describe 'create' do
|
||||||
it 'makes a database' 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)
|
provider.expects(:exists?).returns(true)
|
||||||
expect(provider.create).to be_truthy
|
expect(provider.create).to be_truthy
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,3 +10,8 @@ database{ 'test4':
|
||||||
ensure => present,
|
ensure => present,
|
||||||
charset => 'latin1',
|
charset => 'latin1',
|
||||||
}
|
}
|
||||||
|
database{ 'test5':
|
||||||
|
ensure => present,
|
||||||
|
charset => 'binary',
|
||||||
|
collate => 'binary',
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue