Skip to content

Commit 1ad0a6e

Browse files
committed
Merge pull request #308 from daniel-gadd/feature/config_syntax
Fixed up rabbitmq.conf file layout
2 parents 2f955e1 + 74accfc commit 1ad0a6e

2 files changed

Lines changed: 22 additions & 13 deletions

File tree

spec/classes/rabbitmq_spec.rb

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,10 @@
483483
%r{ssl_listeners, \[3141\]}
484484
)
485485
should contain_file('rabbitmq.config').with_content(
486-
%r{ssl_options, \[\{cacertfile,"/path/to/cacert"}
486+
%r{ssl_options, \[}
487+
)
488+
should contain_file('rabbitmq.config').with_content(
489+
%r{cacertfile,"/path/to/cacert"}
487490
)
488491
should contain_file('rabbitmq.config').with_content(
489492
%r{certfile,"/path/to/cert"}
@@ -507,7 +510,7 @@
507510

508511
it 'should set ssl options to specified values' do
509512
should contain_file('rabbitmq.config').with_content(%r{ssl_listeners, \[\{"0.0.0.0", 3141\}\]})
510-
should contain_file('rabbitmq.config').with_content(%r{ssl_options, \[\{cacertfile,"/path/to/cacert"})
513+
should contain_file('rabbitmq.config').with_content(%r{cacertfile,"/path/to/cacert"})
511514
should contain_file('rabbitmq.config').with_content(%r{certfile,"/path/to/cert"})
512515
should contain_file('rabbitmq.config').with_content(%r{keyfile,"/path/to/key})
513516
end
@@ -528,7 +531,8 @@
528531
it 'should set ssl options to specified values' do
529532
should contain_file('rabbitmq.config').with_content(%r{tcp_listeners, \[\]})
530533
should contain_file('rabbitmq.config').with_content(%r{ssl_listeners, \[3141\]})
531-
should contain_file('rabbitmq.config').with_content(%r{ssl_options, \[\{cacertfile,"/path/to/cacert"})
534+
should contain_file('rabbitmq.config').with_content(%r{ssl_options, \[})
535+
should contain_file('rabbitmq.config').with_content(%r{cacertfile,"/path/to/cacert"})
532536
should contain_file('rabbitmq.config').with_content(%r{certfile,"/path/to/cert"})
533537
should contain_file('rabbitmq.config').with_content(%r{keyfile,"/path/to/key})
534538
end
@@ -548,7 +552,7 @@
548552
it 'should set ssl options to specified values' do
549553
should contain_file('rabbitmq.config').with_content(%r{tcp_listeners, \[\]})
550554
should contain_file('rabbitmq.config').with_content(%r{ssl_listeners, \[\{"0.0.0.0", 3141\}\]})
551-
should contain_file('rabbitmq.config').with_content(%r{ssl_options, \[\{cacertfile,"/path/to/cacert"})
555+
should contain_file('rabbitmq.config').with_content(%r{cacertfile,"/path/to/cacert"})
552556
should contain_file('rabbitmq.config').with_content(%r{certfile,"/path/to/cert"})
553557
should contain_file('rabbitmq.config').with_content(%r{keyfile,"/path/to/key})
554558
end
@@ -566,7 +570,8 @@
566570

567571
it 'should set ssl options to specified values' do
568572
should contain_file('rabbitmq.config').with_content(%r{ssl_listeners, \[3141\]})
569-
should contain_file('rabbitmq.config').with_content(%r{ssl_options, \[\{cacertfile,"/path/to/cacert"})
573+
should contain_file('rabbitmq.config').with_content(%r{ssl_options, \[})
574+
should contain_file('rabbitmq.config').with_content(%r{cacertfile,"/path/to/cacert"})
570575
should contain_file('rabbitmq.config').with_content(%r{certfile,"/path/to/cert"})
571576
should contain_file('rabbitmq.config').with_content(%r{keyfile,"/path/to/key})
572577
should contain_file('rabbitmq.config').with_content(%r{ssl, \[\{versions, \['tlsv1.1', 'tlsv1.2'\]\}\]})

templates/rabbitmq.config.erb

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,18 @@
2626
<%- else -%>
2727
{ssl_listeners, [<%= @ssl_port %>]},
2828
<%- end -%>
29-
{ssl_options, [<%- if @ssl_cacert != 'UNSET' -%>{cacertfile,"<%= @ssl_cacert %>"},<%- end -%>
30-
{certfile,"<%= @ssl_cert %>"},
31-
{keyfile,"<%= @ssl_key %>"},
32-
{verify,<%= @ssl_verify %>},
33-
{fail_if_no_peer_cert,<%= @ssl_fail_if_no_peer_cert %>}
34-
<%- if @ssl_versions -%>
35-
,{versions, [<%= @ssl_versions.sort.map { |v| "'#{v}'" }.join(', ') %>]}
36-
<% end -%>]},
29+
{ssl_options, [
30+
<%- if @ssl_cacert != 'UNSET' -%>
31+
{cacertfile,"<%= @ssl_cacert %>"},
32+
<%- end -%>
33+
{certfile,"<%= @ssl_cert %>"},
34+
{keyfile,"<%= @ssl_key %>"},
35+
{verify,<%= @ssl_verify %>},
36+
{fail_if_no_peer_cert,<%= @ssl_fail_if_no_peer_cert %>}
37+
<%- if @ssl_versions -%>
38+
,{versions, [<%= @ssl_versions.sort.map { |v| "'#{v}'" }.join(', ') %>]}
39+
<%- end -%>
40+
]},
3741
<%- end -%>
3842
<% if @config_variables -%>
3943
<%- @config_variables.keys.sort.each do |key| -%>

0 commit comments

Comments
 (0)