From 5d0a9ff7e387ea92aac72783b394edc800f5f3de Mon Sep 17 00:00:00 2001 From: Daniel Gadd Date: Mon, 23 Feb 2015 09:47:42 +1300 Subject: [PATCH 1/2] Fixed up rabbitmq.conf file layout Fixed layout of ssl_options section to make sure they are on separate lines, making it easier to read when the file is cat'ed. --- templates/rabbitmq.config.erb | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/templates/rabbitmq.config.erb b/templates/rabbitmq.config.erb index 5681ec638..c81096552 100644 --- a/templates/rabbitmq.config.erb +++ b/templates/rabbitmq.config.erb @@ -26,14 +26,18 @@ <%- else -%> {ssl_listeners, [<%= @ssl_port %>]}, <%- end -%> - {ssl_options, [<%- if @ssl_cacert != 'UNSET' -%>{cacertfile,"<%= @ssl_cacert %>"},<%- end -%> - {certfile,"<%= @ssl_cert %>"}, - {keyfile,"<%= @ssl_key %>"}, - {verify,<%= @ssl_verify %>}, - {fail_if_no_peer_cert,<%= @ssl_fail_if_no_peer_cert %>} - <%- if @ssl_versions -%> - ,{versions, [<%= @ssl_versions.sort.map { |v| "'#{v}'" }.join(', ') %>]} - <% end -%>]}, + {ssl_options, [ + <%- if @ssl_cacert != 'UNSET' -%> + {cacertfile,"<%= @ssl_cacert %>"}, + <%- end -%> + {certfile,"<%= @ssl_cert %>"}, + {keyfile,"<%= @ssl_key %>"}, + {verify,<%= @ssl_verify %>}, + {fail_if_no_peer_cert,<%= @ssl_fail_if_no_peer_cert %>} + <%- if @ssl_versions -%> + ,{versions, [<%= @ssl_versions.sort.map { |v| "'#{v}'" }.join(', ') %>]} + <%- end -%> + ]}, <%- end -%> <% if @config_variables -%> <%- @config_variables.keys.sort.each do |key| -%> From 74accfc6df5bcb7e8639499cb404543ce19b9a62 Mon Sep 17 00:00:00 2001 From: Daniel Gadd Date: Mon, 23 Feb 2015 09:48:17 +1300 Subject: [PATCH 2/2] Fixed rspec tests to follow new syntax layout Resolved issues with spec tests failing as the file layout changed with new lines, causing errors in the tests. I have updated the ssl_options sections to ensure the changes are reflected in testing. --- spec/classes/rabbitmq_spec.rb | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/spec/classes/rabbitmq_spec.rb b/spec/classes/rabbitmq_spec.rb index 56f632e38..4a547780a 100644 --- a/spec/classes/rabbitmq_spec.rb +++ b/spec/classes/rabbitmq_spec.rb @@ -483,7 +483,10 @@ %r{ssl_listeners, \[3141\]} ) should contain_file('rabbitmq.config').with_content( - %r{ssl_options, \[\{cacertfile,"/path/to/cacert"} + %r{ssl_options, \[} + ) + should contain_file('rabbitmq.config').with_content( + %r{cacertfile,"/path/to/cacert"} ) should contain_file('rabbitmq.config').with_content( %r{certfile,"/path/to/cert"} @@ -507,7 +510,7 @@ it 'should set ssl options to specified values' do should contain_file('rabbitmq.config').with_content(%r{ssl_listeners, \[\{"0.0.0.0", 3141\}\]}) - should contain_file('rabbitmq.config').with_content(%r{ssl_options, \[\{cacertfile,"/path/to/cacert"}) + should contain_file('rabbitmq.config').with_content(%r{cacertfile,"/path/to/cacert"}) should contain_file('rabbitmq.config').with_content(%r{certfile,"/path/to/cert"}) should contain_file('rabbitmq.config').with_content(%r{keyfile,"/path/to/key}) end @@ -528,7 +531,8 @@ it 'should set ssl options to specified values' do should contain_file('rabbitmq.config').with_content(%r{tcp_listeners, \[\]}) should contain_file('rabbitmq.config').with_content(%r{ssl_listeners, \[3141\]}) - should contain_file('rabbitmq.config').with_content(%r{ssl_options, \[\{cacertfile,"/path/to/cacert"}) + should contain_file('rabbitmq.config').with_content(%r{ssl_options, \[}) + should contain_file('rabbitmq.config').with_content(%r{cacertfile,"/path/to/cacert"}) should contain_file('rabbitmq.config').with_content(%r{certfile,"/path/to/cert"}) should contain_file('rabbitmq.config').with_content(%r{keyfile,"/path/to/key}) end @@ -548,7 +552,7 @@ it 'should set ssl options to specified values' do should contain_file('rabbitmq.config').with_content(%r{tcp_listeners, \[\]}) should contain_file('rabbitmq.config').with_content(%r{ssl_listeners, \[\{"0.0.0.0", 3141\}\]}) - should contain_file('rabbitmq.config').with_content(%r{ssl_options, \[\{cacertfile,"/path/to/cacert"}) + should contain_file('rabbitmq.config').with_content(%r{cacertfile,"/path/to/cacert"}) should contain_file('rabbitmq.config').with_content(%r{certfile,"/path/to/cert"}) should contain_file('rabbitmq.config').with_content(%r{keyfile,"/path/to/key}) end @@ -566,7 +570,8 @@ it 'should set ssl options to specified values' do should contain_file('rabbitmq.config').with_content(%r{ssl_listeners, \[3141\]}) - should contain_file('rabbitmq.config').with_content(%r{ssl_options, \[\{cacertfile,"/path/to/cacert"}) + should contain_file('rabbitmq.config').with_content(%r{ssl_options, \[}) + should contain_file('rabbitmq.config').with_content(%r{cacertfile,"/path/to/cacert"}) should contain_file('rabbitmq.config').with_content(%r{certfile,"/path/to/cert"}) should contain_file('rabbitmq.config').with_content(%r{keyfile,"/path/to/key}) should contain_file('rabbitmq.config').with_content(%r{ssl, \[\{versions, \['tlsv1.1', 'tlsv1.2'\]\}\]})