Skip to content

Commit

Permalink
Configure ssl_listener in stomp only for ssl
Browse files Browse the repository at this point in the history
W/o this patch puppet will always configure
ssl_listener for stomp and rabbitmq service will
fail to start, if ssl => false.

The solution is to ignore ssl_stomp_port in
config_stomp stanza then ssl was not enabled
and issue a puppet warn about that as well.

Closes-bug: #MODULES-1414

Signed-off-by: Bogdan Dobrelya <[email protected]>
  • Loading branch information
Bogdan Dobrelya committed Oct 14, 2014
1 parent cbda1ce commit fb99957
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
4 changes: 4 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@
fail('$ssl_only => true requires that $ssl => true')
}

if $config_stomp and $ssl_stomp_port and ! $ssl {
warning('$ssl_stomp_port requires that $ssl => true and will be ignored')
}

include '::rabbitmq::install'
include '::rabbitmq::config'
include '::rabbitmq::service'
Expand Down
14 changes: 11 additions & 3 deletions spec/classes/rabbitmq_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,19 @@
})
end
end
describe 'stomp when set ssl port w/o ssl enabled' do
let(:params) {{ :config_stomp => true, :stomp_port => 5679, :ssl => false, :ssl_stomp_port => 5680 }}
it 'should not configure ssl_listeners in rabbitmq.config' do
should contain_file('rabbitmq.config').without({
'content' => /rabbitmq_stomp.*ssl_listeners, \[5680\]/m,
})
end
end
describe 'stomp when set with ssl' do
let(:params) {{ :config_stomp => true, :stomp_port => 5679, :ssl_stomp_port => 5680 }}
let(:params) {{ :config_stomp => true, :stomp_port => 5679, :ssl => true, :ssl_stomp_port => 5680 }}
it 'should specify stomp port and ssl stomp port in rabbitmq.config' do
contain_file('rabbitmq.config').with({
'content' => /rabbitmq_stomp.*tcp_listeners, \[5679\].*ssl_listeners, \[5680\]/,
should contain_file('rabbitmq.config').with({
'content' => /rabbitmq_stomp.*tcp_listeners, \[5679\].*ssl_listeners, \[5680\]/m,
})
end
end
Expand Down
2 changes: 1 addition & 1 deletion templates/rabbitmq.config.erb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
% Configure the Stomp Plugin listening port
{rabbitmq_stomp, [
{tcp_listeners, [<%= @stomp_port %>]}
<%- if @ssl_stomp_port -%>,
<%- if @ssl && @ssl_stomp_port -%>,
{ssl_listeners, [<%= @ssl_stomp_port %>]}
<%- end -%>
]}
Expand Down

0 comments on commit fb99957

Please sign in to comment.