Allow options with values of false to override things that mysql default to true

instead of being elided, leaving the default.
This commit is contained in:
Jim Radford 2014-01-22 17:36:08 -08:00
parent 08e8477e96
commit 136b1aa646
2 changed files with 20 additions and 4 deletions

View file

@ -33,6 +33,24 @@ describe 'mysql::server' do
end
end
describe 'an option set to true' do
let(:params) {
{ :override_options => { 'mysqld' => { 'ssl' => true } }}
}
it do
should contain_file('/etc/my.cnf').with_content(/^\s*ssl\s*(?:$|= true)/m)
end
end
describe 'an option set to false' do
let(:params) {
{ :override_options => { 'mysqld' => { 'ssl' => false } }}
}
it do
should contain_file('/etc/my.cnf').with_content(/^\s*ssl = false/m)
end
end
context 'with remove_default_accounts set' do
let (:params) {{ :remove_default_accounts => true }}
it { should contain_class('mysql::server::account_security') }

View file

@ -2,16 +2,14 @@
<% if v.is_a?(Hash) -%>
[<%= k %>]
<% v.sort.map do |ki, vi| -%>
<% if vi == true -%>
<% if vi == true or v == '' -%>
<%= ki %>
<% elsif vi.is_a?(Array) -%>
<% vi.each do |vii| -%>
<%= ki %> = <%= vii %>
<% end -%>
<% elsif vi and vi != '' -%>
<% else -%>
<%= ki %> = <%= vi %>
<% elsif vi -%>
<%= ki %>
<% end -%>
<% end -%>
<% end %>