Skip to content

Commit

Permalink
Cleanup void tcp options
Browse files Browse the repository at this point in the history
After Ranch (socket acceptor pool) has come into effect
the following tcp listen options is no longer valid:
  - binary, packet, reuseaddr.

For details:
rabbitmq/rabbitmq-server#260
  • Loading branch information
mpolenchuk committed May 11, 2016
1 parent 39d0fdf commit df674c9
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 12 deletions.
5 changes: 5 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@
# Handle env variables.
$environment_variables = merge($default_env_variables, $rabbitmq::environment_variables)

# Try to get version from fact, otherwise use init class variable,
# then detect ranch (socket acceptor pool) availability.
$version = pick($::rabbitmq_version, $rabbitmq::version)
$ranch = versioncmp($version, '3.6') >= 0

file { '/etc/rabbitmq':
ensure => directory,
owner => '0',
Expand Down
15 changes: 12 additions & 3 deletions spec/classes/rabbitmq_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@
['Debian', 'RedHat', 'SUSE', 'Archlinux'].each do |distro|
osfacts = {
:osfamily => distro,
:staging_http_get => ''
:staging_http_get => '',
:rabbitmq_version => '3.6.1'
}

case distro
Expand Down Expand Up @@ -1340,7 +1341,14 @@
end

context "on Archlinux" do
let(:facts) {{ :osfamily => 'Archlinux', :staging_http_get => ''}}
let(:facts) do
{
:osfamily => 'Archlinux',
:staging_http_get => '',
:rabbitmq_version => '3.6.1'
}
end

it 'installs the rabbitmq package' do
should contain_package('rabbitmq-server').with(
'ensure' => 'installed',
Expand Down Expand Up @@ -1401,7 +1409,8 @@
['RedHat', 'SuSE'].each do |distro|
osfacts = {
:osfamily => distro,
:staging_http_get => ''
:staging_http_get => '',
:rabbitmq_version => '3.6.1'
}

case distro
Expand Down
9 changes: 6 additions & 3 deletions spec/spec_helper_local.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ def with_debian_facts
:lsbdistid => 'Debian',
:lsbdistcodename => 'squeeze',
:osfamily => 'Debian',
:staging_http_get => ''
:staging_http_get => '',
:rabbitmq_version => '3.6.1'
}
end
end
Expand All @@ -17,7 +18,8 @@ def with_openbsd_facts
{
:osfamily => 'OpenBSD',
:kernelversion => '5.9',
:staging_http_get => ''
:staging_http_get => '',
:rabbitmq_version => '3.6.1'
}
end
end
Expand All @@ -27,7 +29,8 @@ def with_redhat_facts
{
:osfamily => 'Redhat',
:operatingsystemmajrelease => '7',
:staging_http_get => ''
:staging_http_get => '',
:rabbitmq_version => '3.6.1'
}
end
end
14 changes: 8 additions & 6 deletions templates/rabbitmq.config.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,19 @@
{cluster_nodes, {[<%= @cluster_nodes.map { |n| "\'rabbit@#{n}\'" }.join(', ') %>], <%= @cluster_node_type %>}},
{cluster_partition_handling, <%= @cluster_partition_handling %>},
<% end -%>
{tcp_listen_options,
[binary,
{tcp_listen_options, [
<%- unless @ranch -%>
binary,
{packet, raw},
{reuseaddr, true},
<%- end -%>
<%- if @tcp_keepalive -%>
{keepalive, true},
<%- end -%>
{packet, raw},
{reuseaddr, true},
{backlog, 128},
{nodelay, true},
{exit_on_close, false}]
},
{exit_on_close, false}
]},
<%- if @ssl_only -%>
{tcp_listeners, []},
<%- elsif @interface != 'UNSET' -%>
Expand Down

0 comments on commit df674c9

Please sign in to comment.