diff --git a/manifests/init.pp b/manifests/init.pp index eabb9072..8498bac1 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -47,6 +47,18 @@ # (Optional) Syslog facility to receive log lines. # Defaults to undef. # +# [*default_transport_url*] +# (optional) A URL representing the messaging driver to use and its full +# configuration. Transport URLs take the form: +# transport://user:pass@host1:port[,hostN:portN]/virtual_host +# Defaults to $::os_service_default +# +# [*notification_transport_url*] +# (optional) A URL representing the messaging driver to use for notifications +# and its full configuration. Transport URLs take the form: +# transport://user:pass@host1:port[,hostN:portN]/virtual_host +# Defaults to $::os_service_default +# # [*rpc_backend*] # The messaging driver to use, defaults to rabbit. Other drivers include # amqp and zmq. (string value) @@ -227,6 +239,8 @@ class ceilometer( $log_dir = undef, $use_stderr = undef, $log_facility = undef, + $default_transport_url = $::os_service_default, + $notification_transport_url = $::os_service_default, $rpc_backend = $::os_service_default, $rabbit_host = $::os_service_default, $rabbit_port = $::os_service_default, @@ -369,7 +383,14 @@ class ceilometer( 'database/metering_time_to_live' : value => $metering_time_to_live; } - oslo::messaging::notifications { 'ceilometer_config': topics => $notification_topics } + oslo::messaging::notifications { 'ceilometer_config': + transport_url => $notification_transport_url, + topics => $notification_topics, + } + + oslo::messaging::default { 'ceilometer_config': + transport_url => $default_transport_url, + } oslo::cache { 'ceilometer_config': memcache_servers => $memcached_servers, diff --git a/releasenotes/notes/add_transport_url_parameters-8c4c520e5cce0edc.yaml b/releasenotes/notes/add_transport_url_parameters-8c4c520e5cce0edc.yaml new file mode 100644 index 00000000..a7213685 --- /dev/null +++ b/releasenotes/notes/add_transport_url_parameters-8c4c520e5cce0edc.yaml @@ -0,0 +1,3 @@ +--- +features: + - Add oslo.messaging transport_url parameters via puppet-oslo resource \ No newline at end of file diff --git a/spec/classes/ceilometer_init_spec.rb b/spec/classes/ceilometer_init_spec.rb index 19cf05e2..18b61dab 100644 --- a/spec/classes/ceilometer_init_spec.rb +++ b/spec/classes/ceilometer_init_spec.rb @@ -115,8 +115,13 @@ describe 'ceilometer' do it { expect { is_expected.to raise_error(Puppet::Error) } } end - it 'configures notification_topics' do + it 'configures default transport_url' do + is_expected.to contain_ceilometer_config('DEFAULT/transport_url').with_value('<SERVICE DEFAULT>') + end + + it 'configures notifications' do is_expected.to contain_ceilometer_config('oslo_messaging_notifications/topics').with_value('notifications') + is_expected.to contain_ceilometer_config('oslo_messaging_notifications/transport_url').with_value('<SERVICE DEFAULT>') end context 'with rabbitmq durable queues configured' do @@ -124,11 +129,25 @@ describe 'ceilometer' do it_configures 'rabbit with durable queues' end - context 'with overriden notification_topics parameter' do - before { params.merge!( :notification_topics => ['notifications', 'custom']) } + context 'with overriden transport_url parameter' do + before { params.merge!( :default_transport_url => 'rabbit://rabbit_user:password@localhost:5673' ) } - it 'configures notification_topics' do + it 'configures transport_url' do + is_expected.to contain_ceilometer_config('DEFAULT/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') + end + end + + context 'with overriden notification parameters' do + before { + params.merge!( + :notification_topics => ['notifications', 'custom'], + :notification_transport_url => 'rabbit://rabbit_user:password@localhost:5673', + ) + } + + it 'configures notifications' do is_expected.to contain_ceilometer_config('oslo_messaging_notifications/topics').with_value('notifications,custom') + is_expected.to contain_ceilometer_config('oslo_messaging_notifications/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') end end end