diff --git a/manifests/init.pp b/manifests/init.pp index f91e1afc2..757a4988c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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' diff --git a/spec/classes/rabbitmq_spec.rb b/spec/classes/rabbitmq_spec.rb index 8c9b39a26..e4b9eebd2 100644 --- a/spec/classes/rabbitmq_spec.rb +++ b/spec/classes/rabbitmq_spec.rb @@ -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 diff --git a/templates/rabbitmq.config.erb b/templates/rabbitmq.config.erb index 5f0bef51b..8f6b14f75 100644 --- a/templates/rabbitmq.config.erb +++ b/templates/rabbitmq.config.erb @@ -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 -%> ]}