Skip to content

Commit

Permalink
Merge pull request redhat-openstack#224 from misterdorm/adminfixes2
Browse files Browse the repository at this point in the history
Bugfix and feature: Support for configuring the rabbitmq_management web UI
  • Loading branch information
hunner committed Aug 27, 2014
2 parents df52e34 + cf3e1a5 commit 76e742b
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 13 deletions.
7 changes: 0 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ rvm:
- 2.1.1
env:
matrix:
- PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0"
- PUPPET_GEM_VERSION="~> 3.4.0"
- PUPPET_GEM_VERSION="~> 3.5.0"
global:
Expand All @@ -26,12 +25,6 @@ env:
495e61kP5cxcKNVdDJSiUPPK6fNGQ1xX8=
matrix:
exclude:
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0"
- rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0"
- rvm: 2.1.1
env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0"
- rvm: 2.1.1
env: PUPPET_GEM_VERSION="~> 3.4.0"
notifications:
Expand Down
3 changes: 3 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class rabbitmq::config {

$admin_enable = $rabbitmq::admin_enable
$cluster_disk_nodes = $rabbitmq::cluster_disk_nodes
$cluster_node_type = $rabbitmq::cluster_node_type
$cluster_nodes = $rabbitmq::cluster_nodes
Expand All @@ -12,6 +13,7 @@
$env_config = $rabbitmq::env_config
$env_config_path = $rabbitmq::env_config_path
$erlang_cookie = $rabbitmq::erlang_cookie
$management_port = $rabbitmq::management_port
$node_ip_address = $rabbitmq::node_ip_address
$plugin_dir = $rabbitmq::plugin_dir
$port = $rabbitmq::port
Expand All @@ -21,6 +23,7 @@
$ssl_cacert = $rabbitmq::ssl_cacert
$ssl_cert = $rabbitmq::ssl_cert
$ssl_key = $rabbitmq::ssl_key
$ssl_port = $rabbitmq::ssl_port
$ssl_management_port = $rabbitmq::ssl_management_port
$ssl_stomp_port = $rabbitmq::ssl_stomp_port
$ssl_verify = $rabbitmq::ssl_verify
Expand Down
3 changes: 2 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
$ssl_cacert = $rabbitmq::params::ssl_cacert,
$ssl_cert = $rabbitmq::params::ssl_cert,
$ssl_key = $rabbitmq::params::ssl_key,
$ssl_port = $rabbitmq::params::ssl_port,
$ssl_management_port = $rabbitmq::params::ssl_management_port,
$ssl_stomp_port = $rabbitmq::params::ssl_stomp_port,
$ssl_verify = $rabbitmq::params::ssl_verify,
Expand Down Expand Up @@ -91,7 +92,7 @@
validate_string($ssl_cacert)
validate_string($ssl_cert)
validate_string($ssl_key)
validate_string($ssl_management_port)
validate_re($ssl_port, '\d+')
validate_re($ssl_management_port, '\d+')
validate_string($ssl_stomp_port)
validate_re($ssl_stomp_port, '\d+')
Expand Down
3 changes: 2 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
$ssl_cacert = 'UNSET'
$ssl_cert = 'UNSET'
$ssl_key = 'UNSET'
$ssl_management_port = '5671'
$ssl_port = '5671'
$ssl_management_port = '15671'
$ssl_stomp_port = '6164'
$ssl_verify = 'verify_none'
$ssl_fail_if_no_peer_cert = 'false'
Expand Down
88 changes: 85 additions & 3 deletions spec/classes/rabbitmq_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@
describe 'ssl options' do
let(:params) {
{ :ssl => true,
:ssl_management_port => 3141,
:ssl_port => 3141,
:ssl_cacert => '/path/to/cacert',
:ssl_cert => '/path/to/cert',
:ssl_key => '/path/to/key'
Expand All @@ -334,7 +334,7 @@
it 'should set ssl options to specified values' do
contain_file('rabbitmq.config').with({
'content' => %r|ssl_listeners, \[3141\].*
ssl_options, \[{cacertfile,"/path/to/cacert".*
ssl_options, \[\{cacertfile,"/path/to/cacert".*
certfile="/path/to/cert".*
keyfile,"/path/to/key|,
})
Expand All @@ -355,13 +355,95 @@
contain_file('rabbitmq.config').with({
'content' => %r|tcp_listeners, \[\].*
ssl_listeners, \[3141\].*
ssl_options, \[{cacertfile,"/path/to/cacert".*
ssl_options, \[\{cacertfile,"/path/to/cacert".*
certfile="/path/to/cert".*
keyfile,"/path/to/key|,
})
end
end

describe 'ssl admin options' do
let(:params) {
{ :ssl => true,
:ssl_management_port => 3141,
:ssl_cacert => '/path/to/cacert',
:ssl_cert => '/path/to/cert',
:ssl_key => '/path/to/key',
:admin_enable => true
} }

it 'should set rabbitmq_management ssl options to specified values' do
contain_file('rabbitmq.config').with({
'content' => %r|\{rabbitmq_management, \[.*
\{listener, \[.*
\{port, 3141\},.*
\{ssl, true\},.*
\{ssl_opts, \[\{cacertfile, "/path/to/cacert"\},.*
\{certfile, "/path/to/cert"\},.*
\{keyfile, "/path/to/key"\}\]\}.*
\]\}|,
})
end
end

describe 'admin without ssl' do
let(:params) {
{ :ssl => false,
:management_port => 3141,
:admin_enable => true
} }

it 'should set rabbitmq_management options to specified values' do
contain_file('rabbitmq.config').with({
'content' => /\{rabbitmq_management, \[.*
\{listener, \[.*
\{port, 3141\},.*
\]\}/,
})
end
end

describe 'ssl admin options' do
let(:params) {
{ :ssl => true,
:ssl_management_port => 3141,
:ssl_cacert => '/path/to/cacert',
:ssl_cert => '/path/to/cert',
:ssl_key => '/path/to/key',
:admin_enable => true
} }

it 'should set rabbitmq_management ssl options to specified values' do
contain_file('rabbitmq.config').with({
'content' => %r|\{rabbitmq_management, \[.*
\{listener, \[.*
\{port, 3141\},.*
\{ssl, true\},.*
\{ssl_opts, \[\{cacertfile, "/path/to/cacert"\},.*
\{certfile, "/path/to/cert"\},.*
\{keyfile, "/path/to/key"\}\]\}.*
\]\}|,
})
end
end

describe 'admin without ssl' do
let(:params) {
{ :ssl => false,
:management_port => 3141,
:admin_enable => true
} }

it 'should set rabbitmq_management options to specified values' do
contain_file('rabbitmq.config').with({
'content' => /\{rabbitmq_management, \[.*
\{listener, \[.*
\{port, 3141\},.*
\]\}/,
})
end
end

describe 'config_variables options' do
let(:params) {{ :config_variables => {
'hipe_compile' => true,
Expand Down
17 changes: 16 additions & 1 deletion templates/rabbitmq.config.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{tcp_listeners, []},
<%- end -%>
<%- if @ssl -%>
{ssl_listeners, [<%= @ssl_management_port %>]},
{ssl_listeners, [<%= @ssl_port %>]},
{ssl_options, [{cacertfile,"<%= @ssl_cacert %>"},
{certfile,"<%= @ssl_cert %>"},
{keyfile,"<%= @ssl_key %>"},
Expand All @@ -32,6 +32,21 @@
<%= @config_kernel_variables.sort.map{|k,v| "{#{k}, #{v}}"}.join(",\n ") %>
]}
<%- end -%>
<%- if @admin_enable -%>,
{rabbitmq_management, [
{listener, [
<%- if @ssl -%>
{port, <%= @ssl_management_port %>},
{ssl, true},
{ssl_opts, [{cacertfile, "<%= @ssl_cacert %>"},
{certfile, "<%= @ssl_cert %>"},
{keyfile, "<%= @ssl_key %>"}]}
<%- else -%>
{port, <%= @management_port %>}
<%- end -%>
]}
]}
<%- end -%>
<% if @config_stomp -%>,
% Configure the Stomp Plugin listening port
{rabbitmq_stomp, [
Expand Down

0 comments on commit 76e742b

Please sign in to comment.