Skip to content

Commit

Permalink
Merge pull request redhat-openstack#231 from misterdorm/tcpkeepalive
Browse files Browse the repository at this point in the history
adding tcp_keepalive parameter
  • Loading branch information
hunner committed Aug 27, 2014
2 parents 76e742b + 30f3fe6 commit bf59be0
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,10 @@ The port to use for Stomp.

Boolean to install the stomp plugin.

####`tcp_keepalive`

Boolean to enable TCP connection keepalive for RabbitMQ service.

####`version`

Sets the version to install.
Expand Down
1 change: 1 addition & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
$node_ip_address = $rabbitmq::node_ip_address
$plugin_dir = $rabbitmq::plugin_dir
$port = $rabbitmq::port
$tcp_keepalive = $rabbitmq::tcp_keepalive
$service_name = $rabbitmq::service_name
$ssl = $rabbitmq::ssl
$ssl_only = $rabbitmq::ssl_only
Expand Down
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
$manage_repos = $rabbitmq::params::manage_repos,
$plugin_dir = $rabbitmq::params::plugin_dir,
$port = $rabbitmq::params::port,
$tcp_keepalive = $rabbitmq::params::tcp_keepalive,
$service_ensure = $rabbitmq::params::service_ensure,
$service_manage = $rabbitmq::params::service_manage,
$service_name = $rabbitmq::params::service_name,
Expand Down Expand Up @@ -83,6 +84,7 @@
validate_re($port, ['\d+','UNSET'])
validate_re($stomp_port, '\d+')
validate_bool($wipe_db_on_cookie_change)
validate_bool($tcp_keepalive)
# Validate service parameters.
validate_re($service_ensure, '^(running|stopped)$')
validate_bool($service_manage)
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
$node_ip_address = 'UNSET'
$plugin_dir = "/usr/lib/rabbitmq/lib/rabbitmq_server-${version}/plugins"
$port = '5672'
$tcp_keepalive = false
$ssl = false
$ssl_only = false
$ssl_cacert = 'UNSET'
Expand Down
27 changes: 27 additions & 0 deletions spec/classes/rabbitmq_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,33 @@
end
end

describe 'tcp_keepalive enabled' do
let(:params) {{ :tcp_keepalive => true }}
it 'should set tcp_listen_options keepalive true' do
should contain_file('rabbitmq.config') \
.with_content(/\{tcp_listen_options, \[\{keepalive, true\}\]\},/)
end
end

describe 'tcp_keepalive disabled (default)' do
it 'should not set tcp_listen_options' do
should contain_file('rabbitmq.config') \
.without_content(/\{tcp_listen_options, \[\{keepalive, true\}\]\},/)
end
end

describe 'non-bool tcp_keepalive parameter' do
let :params do
{ :tcp_keepalive => 'string' }
end

it 'should raise an error' do
expect {
should contain_file('rabbitmq.config')
}.to raise_error(Puppet::Error, /is not a boolean/)
end
end

context 'delete_guest_user' do
describe 'should do nothing by default' do
it { should_not contain_rabbitmq_user('guest') }
Expand Down
3 changes: 3 additions & 0 deletions templates/rabbitmq.config.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
{cluster_nodes, {[<%= @r_cluster_nodes.map { |n| "\'rabbit@#{n}\'" }.join(', ') %>], <%= @cluster_node_type %>}},
{cluster_partition_handling, <%= @cluster_partition_handling %>},
<% end -%>
<%- if @tcp_keepalive -%>
{tcp_listen_options, [{keepalive, true}]},
<%- end -%>
<%- if @ssl_only -%>
{tcp_listeners, []},
<%- end -%>
Expand Down

0 comments on commit bf59be0

Please sign in to comment.