Merge "Update ceilometer proxy template"
This commit is contained in:
commit
b62ed3a5ca
|
@ -7,6 +7,43 @@
|
|||
#
|
||||
# == Parameters
|
||||
#
|
||||
# [*rabbit_host*]
|
||||
# (Optional) IP or hostname of the rabbit server.
|
||||
# Defaults to '127.0.0.1'.
|
||||
#
|
||||
# [*rabbit_port*]
|
||||
# (Optional) Port of the rabbit server.
|
||||
# Defaults to 5672.
|
||||
#
|
||||
# [*rabbit_hosts*]
|
||||
# (Optional) IP or hostname of the rabbits servers.
|
||||
# comma separated array (ex: ['1.0.0.10:5672','1.0.0.11:5672'])
|
||||
# Defaults to undef.
|
||||
#
|
||||
# [*rabbit_user*]
|
||||
# (Optional) Username for rabbit.
|
||||
# Defaults to 'guest'.
|
||||
#
|
||||
# [*rabbit_password*]
|
||||
# (Optional) Password for rabbit user.
|
||||
# Defaults to 'guest'.
|
||||
#
|
||||
# [*rabbit_virtual_host*]
|
||||
# (Optional) Virtual host to use.
|
||||
# Defaults to '/'.
|
||||
#
|
||||
# [*driver*]
|
||||
# (Optional) The Drivers(s) to handle sending notifications.
|
||||
# Defaults to undef.
|
||||
#
|
||||
# [*topic*]
|
||||
# (Optional) AMQP topic used for OpenStack notifications.
|
||||
# Defaults to undef.
|
||||
#
|
||||
# [*control_exchange*]
|
||||
# (Optional) The default exchange under which topics are scoped.
|
||||
# Defaults to undef.
|
||||
#
|
||||
# [*ensure*]
|
||||
# Enable or not ceilometer fragment
|
||||
# Defaults to 'present'
|
||||
|
@ -28,8 +65,17 @@
|
|||
# Copyright 2013 eNovance licensing@enovance.com
|
||||
#
|
||||
class swift::proxy::ceilometer(
|
||||
$ensure = 'present',
|
||||
$group = 'ceilometer',
|
||||
$rabbit_user = 'guest',
|
||||
$rabbit_password = 'guest',
|
||||
$rabbit_host = '127.0.0.1',
|
||||
$rabbit_port = '5672',
|
||||
$rabbit_hosts = undef,
|
||||
$rabbit_virtual_host = '/',
|
||||
$driver = undef,
|
||||
$topic = undef,
|
||||
$control_exchange = undef,
|
||||
$ensure = 'present',
|
||||
$group = 'ceilometer',
|
||||
) inherits swift {
|
||||
|
||||
User['swift'] {
|
||||
|
@ -54,4 +100,9 @@ class swift::proxy::ceilometer(
|
|||
require => Class['::ceilometer'],
|
||||
}
|
||||
|
||||
package { 'python-ceilometermiddleware':
|
||||
ensure => $ensure,
|
||||
tag => 'openstack',
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,8 @@ describe 'swift::proxy::ceilometer' do
|
|||
|
||||
describe "when using default parameters" do
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/[filter:ceilometer]/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/use = egg:ceilometer#swift/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/paste.filter_factory = ceilometermiddleware.swift:filter_factory/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/url = rabbit:\/\/guest:guest@127.0.0.1:5672\//) }
|
||||
if Puppet.version.to_f < 4.0
|
||||
it { is_expected.to contain_concat__fragment('swift_ceilometer').with_require('Class[Ceilometer]')}
|
||||
else
|
||||
|
@ -34,9 +35,42 @@ describe 'swift::proxy::ceilometer' do
|
|||
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{ :group => 'www-data' }
|
||||
{ :group => 'www-data',
|
||||
:rabbit_user => 'user_1',
|
||||
:rabbit_password => 'user_1_passw',
|
||||
:rabbit_host => '1.1.1.1',
|
||||
:rabbit_port => '5673',
|
||||
:rabbit_virtual_host => 'rabbit',
|
||||
:driver => 'messagingv2',
|
||||
:topic => 'notifications',
|
||||
:control_exchange => 'swift',
|
||||
}
|
||||
end
|
||||
it { is_expected.to contain_user('swift').with_groups('www-data') }
|
||||
|
||||
context 'with single rabbit host' do
|
||||
it { is_expected.to contain_user('swift').with_groups('www-data') }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/[filter:ceilometer]/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/paste.filter_factory = ceilometermiddleware.swift:filter_factory/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/url = rabbit:\/\/user_1:user_1_passw@1.1.1.1:5673\/rabbit/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/driver = messagingv2/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/topic = notifications/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/control_exchange = swift/) }
|
||||
end
|
||||
|
||||
context 'with multiple rabbit hosts' do
|
||||
before do
|
||||
params.merge!({ :rabbit_hosts => ['127.0.0.1:5672', '127.0.0.2:5672'] })
|
||||
end
|
||||
|
||||
it { is_expected.to contain_user('swift').with_groups('www-data') }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/[filter:ceilometer]/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/paste.filter_factory = ceilometermiddleware.swift:filter_factory/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/url = rabbit:\/\/user_1:user_1_passw@127.0.0.1:5672,127.0.0.2:5672\/rabbit/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/driver = messagingv2/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/topic = notifications/) }
|
||||
it { is_expected.to contain_file(fragment_file).with_content(/control_exchange = swift/) }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
|
||||
[filter:ceilometer]
|
||||
use = egg:ceilometer#swift
|
||||
paste.filter_factory = ceilometermiddleware.swift:filter_factory
|
||||
<% if @rabbit_hosts.nil? %>
|
||||
url = rabbit://<%= @rabbit_user %>:<%= @rabbit_password %>@<%= @rabbit_host %>:<%= @rabbit_port %>/<%= @rabbit_virtual_host %>
|
||||
<% else %>
|
||||
<% hosts=Array(@rabbit_hosts).join(",") -%>
|
||||
url = rabbit://<%= @rabbit_user %>:<%= @rabbit_password %>@<%= hosts %>/<%= @rabbit_virtual_host %>
|
||||
<% end %>
|
||||
<% if @driver %>
|
||||
driver = <%= @driver %>
|
||||
<% end %>
|
||||
<% if @topic %>
|
||||
topic = <%= @topic %>
|
||||
<% end %>
|
||||
<% if @control_exchange %>
|
||||
control_exchange = <%= @control_exchange %>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in New Issue