Skip to content

Commit 0c62943

Browse files
authored
Merge pull request #1513 from kjetilho/issue1509-ssl-false
do not emit other ssl directives when ssl = false
2 parents 2a400ad + b54ccd4 commit 0c62943

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

spec/classes/mycnf_template_spec.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,28 @@
4747
it { is_expected.to contain_file('mysql-config-file').with_content(%r{ssl = false}) }
4848
end
4949

50+
describe 'ssl set to false filters out ssl options' do
51+
let(:params) { { override_options: { 'mysqld' => { 'ssl' => false, 'ssl-disable' => false, 'ssl-key' => '/etc/key.pem' } } } }
52+
53+
it { is_expected.to contain_file('mysql-config-file').with_content(%r{ssl = false}) }
54+
it { is_expected.to contain_file('mysql-config-file').without_content(%r{ssl-key}) }
55+
end
56+
5057
# ssl-disable (and ssl) are special cased within mysql.
5158
describe 'possibility of disabling ssl completely' do
5259
let(:params) { { override_options: { 'mysqld' => { 'ssl' => true, 'ssl-disable' => true } } } }
5360

5461
it { is_expected.to contain_file('mysql-config-file').without_content(%r{ssl = true}) }
5562
end
5663

64+
describe 'ssl-disable filters other ssl options' do
65+
let(:params) { { override_options: { 'mysqld' => { 'ssl' => true, 'ssl-disable' => true, 'ssl-key' => '/etc/key.pem' } } } }
66+
67+
it { is_expected.to contain_file('mysql-config-file').without_content(%r{ssl = true}) }
68+
it { is_expected.to contain_file('mysql-config-file').without_content(%r{ssl-disable}) }
69+
it { is_expected.to contain_file('mysql-config-file').without_content(%r{ssl-key}) }
70+
end
71+
5772
describe 'a non ssl option set to true' do
5873
let(:params) { { override_options: { 'mysqld' => { 'test' => true } } } }
5974

templates/my.cnf.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<% if v.is_a?(Hash) -%>
55
[<%= k %>]
66
<% v.sort.map do |ki, vi| -%>
7-
<% if ki == 'ssl-disable' or (ki =~ /^ssl/ and v['ssl-disable'] == true) -%>
7+
<% if ki == 'ssl-disable' or (ki =~ /^ssl/ and v['ssl-disable'] == true) or (ki =~ /^ssl-/ and v['ssl'] == false) -%>
88
<% next %>
99
<% elsif vi == true or vi == '' -%>
1010
<%= ki %>

0 commit comments

Comments
 (0)