Added support for messaging urls
Ceilometer supports multiple notifications. The config entry in ceilometer.conf allows for a multi-value for notification/messaging_urls. Change-Id: Ic1791c7021bf2dbb06269317b8495eebc8d6e7ed Closes-Bug: 1564061
This commit is contained in:
parent
d4e3b55929
commit
fd4485d64e
|
@ -1,10 +0,0 @@
|
|||
Puppet::Type.type(:ceilometer_config).provide(
|
||||
:ini_setting,
|
||||
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
|
||||
) do
|
||||
|
||||
def self.file_path
|
||||
'/etc/ceilometer/ceilometer.conf'
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
Puppet::Type.type(:ceilometer_config).provide(
|
||||
:openstackconfig,
|
||||
:parent => Puppet::Type.type(:openstack_config).provider(:ruby)
|
||||
) do
|
||||
|
||||
def self.file_path
|
||||
'/etc/ceilometer/ceilometer.conf'
|
||||
end
|
||||
|
||||
def file_path
|
||||
self.class.file_path
|
||||
end
|
||||
end
|
|
@ -7,8 +7,20 @@ Puppet::Type.newtype(:ceilometer_config) do
|
|||
newvalues(/\S+\/\S+/)
|
||||
end
|
||||
|
||||
newproperty(:value) do
|
||||
newproperty(:value, :array_matching => :all) do
|
||||
desc 'The value of the setting to be defined.'
|
||||
def insync?(is)
|
||||
puts is
|
||||
return true if @should.empty?
|
||||
return false unless is.is_a? Array
|
||||
return false unless is.length == @should.length
|
||||
# we don't care about the order of items in array, hence
|
||||
# it is necessary to override insync
|
||||
return (
|
||||
is & @should == is or
|
||||
is & @should.map(&:to_s) == is
|
||||
)
|
||||
end
|
||||
munge do |value|
|
||||
value = value.to_s.strip
|
||||
value.capitalize! if value =~ /^(true|false)$/i
|
||||
|
|
|
@ -48,6 +48,11 @@
|
|||
# (Optional) Number of workers for notification service (integer value).
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*messaging_urls*]
|
||||
# (Optional) Messaging urls to listen for notifications. (Array of urls)
|
||||
# The format should be transport://user:pass@host1:port[,hostN:portN]/virtual_host
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*package_ensure*]
|
||||
# (Optional) ensure state for package.
|
||||
# Defaults to 'present'.
|
||||
|
@ -59,6 +64,7 @@ class ceilometer::agent::notification (
|
|||
$store_events = false,
|
||||
$disable_non_metric_meters = $::os_service_default,
|
||||
$notification_workers = $::os_service_default,
|
||||
$messaging_urls = $::os_service_default,
|
||||
$package_ensure = 'present',
|
||||
) {
|
||||
|
||||
|
@ -99,6 +105,6 @@ class ceilometer::agent::notification (
|
|||
'notification/store_events' : value => $store_events;
|
||||
'notification/disable_non_metric_meters': value => $disable_non_metric_meters;
|
||||
'notification/workers' : value => $notification_workers;
|
||||
'notification/messaging_urls' : value => $messaging_urls;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
# or Puppet catalog compilation will fail with duplicate resources.
|
||||
#
|
||||
class ceilometer::config (
|
||||
$ceilometer_config = {},
|
||||
$ceilometer_api_paste_ini = {},
|
||||
$ceilometer_config = {},
|
||||
$ceilometer_api_paste_ini = {},
|
||||
) {
|
||||
|
||||
validate_hash($ceilometer_config)
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
features:
|
||||
- Added messaging_urls parameter to ceilometer agents notification.
|
||||
The parameter accepts an array.
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
features:
|
||||
- Switched ceilometer_config from ini_setting type to openstack_config type.
|
||||
- Added the ability to pass in messaging_urls into notifications agent. This
|
||||
will allow a user to configure ceilometer to talk to different virtualhosts
|
||||
or entirely different messaging queues.
|
|
@ -98,6 +98,19 @@ describe 'ceilometer::agent::notification' do
|
|||
end
|
||||
end
|
||||
|
||||
context 'with multiple messaging urls' do
|
||||
before do
|
||||
params.merge!({
|
||||
:messaging_urls => ['rabbit://rabbit_user:password@localhost/nova',
|
||||
'rabbit://rabbit_user:password@localhost/neutron'] })
|
||||
end
|
||||
|
||||
it 'configures two messaging urls' do
|
||||
is_expected.to contain_ceilometer_config('notification/messaging_urls').with_value(
|
||||
['rabbit://rabbit_user:password@localhost/nova', 'rabbit://rabbit_user:password@localhost/neutron']
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
|
|
|
@ -23,7 +23,7 @@ $LOAD_PATH.push(
|
|||
|
||||
require 'spec_helper'
|
||||
|
||||
provider_class = Puppet::Type.type(:ceilometer_config).provider(:ini_setting)
|
||||
provider_class = Puppet::Type.type(:ceilometer_config).provider(:openstackconfig)
|
||||
|
||||
describe provider_class do
|
||||
|
|
@ -30,12 +30,12 @@ describe 'Puppet::Type.type(:ceilometer_config)' do
|
|||
|
||||
it 'should accept a valid value' do
|
||||
@ceilometer_config[:value] = 'bar'
|
||||
expect(@ceilometer_config[:value]).to eq('bar')
|
||||
expect(@ceilometer_config[:value]).to eq(['bar'])
|
||||
end
|
||||
|
||||
it 'should not accept a value with whitespace' do
|
||||
@ceilometer_config[:value] = 'b ar'
|
||||
expect(@ceilometer_config[:value]).to eq('b ar')
|
||||
expect(@ceilometer_config[:value]).to eq(['b ar'])
|
||||
end
|
||||
|
||||
it 'should accept valid ensure values' do
|
||||
|
|
Loading…
Reference in New Issue