Skip to content

Commit

Permalink
Merge branch 'jacyzon-additional_rabbit_configs'
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ Asghar committed Apr 23, 2015
2 parents 03d5dca + 50e5dd2 commit 3c0532b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,4 @@

# conf
default['rabbitmq']['conf'] = {}
default['rabbitmq']['additional_rabbit_configs'] = {}
11 changes: 8 additions & 3 deletions spec/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,21 +88,26 @@
describe 'ssl ciphers' do
it 'has no ssl ciphers specified by default' do
expect(chef_run).not_to render_file('/etc/rabbitmq/rabbitmq.config').with_content(
/{ciphers,[{.*}]}/)
/{ciphers,[{.*}]}/)
end

it 'allows ssl ciphers' do
node.set['rabbitmq']['ssl'] = true
node.set['rabbitmq']['ssl_ciphers'] = ['ecdhe_ecdsa,aes_128_cbc,sha256', 'ecdhe_ecdsa,aes_256_cbc,sha']
expect(chef_run).to render_file('/etc/rabbitmq/rabbitmq.config').with_content(
'{ciphers,[{ecdhe_ecdsa,aes_128_cbc,sha256},{ecdhe_ecdsa,aes_256_cbc,sha}]}')
'{ciphers,[{ecdhe_ecdsa,aes_128_cbc,sha256},{ecdhe_ecdsa,aes_256_cbc,sha}]}')
end

it 'allows web console ssl ciphers' do
node.set['rabbitmq']['web_console_ssl'] = true
node.set['rabbitmq']['ssl_ciphers'] = ['ecdhe_ecdsa,aes_128_cbc,sha256', 'ecdhe_ecdsa,aes_256_cbc,sha']
expect(chef_run).to render_file('/etc/rabbitmq/rabbitmq.config').with_content(
'{ciphers,[{ecdhe_ecdsa,aes_128_cbc,sha256},{ecdhe_ecdsa,aes_256_cbc,sha}]}')
'{ciphers,[{ecdhe_ecdsa,aes_128_cbc,sha256},{ecdhe_ecdsa,aes_256_cbc,sha}]}')
end

it 'should set additional rabbitmq config' do
node.set['rabbitmq']['additional_rabbit_configs'] = { 'foo' => 'bar' }
expect(chef_run).to render_file('/etc/rabbitmq/rabbitmq.config').with_content('foo, bar')
end
end

Expand Down
4 changes: 4 additions & 0 deletions templates/default/rabbitmq.config.erb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@
{default_user, <<"<%= node['rabbitmq']['default_user'] %>">>},
{default_pass, <<"<%= node['rabbitmq']['default_pass'] %>">>},
{heartbeat, <%= node['rabbitmq']['heartbeat'] %>}

<% node['rabbitmq']['additional_rabbit_configs'].each do |key,value| -%>
,{<%= key %>, <%= value %>}
<% end -%>
]}
<% node['rabbitmq']['conf'].each do |key,value| -%>
,{<%= key %>, <%= value %>}
Expand Down

0 comments on commit 3c0532b

Please sign in to comment.