+++ /dev/null
-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
--- /dev/null
+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
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
# (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'.
$store_events = false,
$disable_non_metric_meters = $::os_service_default,
$notification_workers = $::os_service_default,
+ $messaging_urls = $::os_service_default,
$package_ensure = 'present',
) {
'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;
}
-
}
# 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)
--- /dev/null
+---
+features:
+ - Added messaging_urls parameter to ceilometer agents notification.
+ The parameter accepts an array.
--- /dev/null
+---
+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.
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
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
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