diff --git a/manifests/ceilometer.pp b/manifests/ceilometer.pp index 92e2aa32..19567e7f 100644 --- a/manifests/ceilometer.pp +++ b/manifests/ceilometer.pp @@ -5,6 +5,12 @@ # # === Parameters # +# [*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 +# # [*notification_driver*] # (option) Driver or drivers to handle sending notifications. # The default value of 'messagingv2' is for enabling notifications via @@ -14,10 +20,12 @@ # was adopted in icehouse/juno. See LP#1425713. # class cinder::ceilometer ( - $notification_driver = 'messagingv2', + $notification_transport_url = $::os_service_default, + $notification_driver = 'messagingv2', ) { oslo::messaging::notifications { 'cinder_config': - driver => $notification_driver + transport_url => $notification_transport_url, + driver => $notification_driver, } } diff --git a/manifests/init.pp b/manifests/init.pp index c0924cfd..d11f781c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -13,6 +13,12 @@ # (Optional) Should the daemons log debug messages # 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 +# # [*rpc_backend*] # (Optional) Use these options to configure the RabbitMQ message system. # Defaults to 'rabbit' @@ -301,6 +307,7 @@ class cinder ( $database_max_retries = undef, $database_retry_interval = undef, $database_max_overflow = undef, + $default_transport_url = $::os_service_default, $rpc_backend = 'rabbit', $control_exchange = 'openstack', $rabbit_host = $::os_service_default, @@ -454,7 +461,8 @@ class cinder ( } oslo::messaging::default { 'cinder_config': - control_exchange => $control_exchange + transport_url => $default_transport_url, + control_exchange => $control_exchange, } if ! $default_availability_zone { diff --git a/releasenotes/notes/add_transport_url_parameters-29b87bdc9197a376.yaml b/releasenotes/notes/add_transport_url_parameters-29b87bdc9197a376.yaml new file mode 100644 index 00000000..a7213685 --- /dev/null +++ b/releasenotes/notes/add_transport_url_parameters-29b87bdc9197a376.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/cinder_ceilometer_spec.rb b/spec/classes/cinder_ceilometer_spec.rb index 9e8dcefe..edda6573 100644 --- a/spec/classes/cinder_ceilometer_spec.rb +++ b/spec/classes/cinder_ceilometer_spec.rb @@ -1,9 +1,15 @@ require 'spec_helper' - describe 'cinder::ceilometer' do describe 'with default parameters' do + + let :facts do + OSDefaults.get_facts({}) + end + it 'contains default values' do + is_expected.to contain_cinder_config('oslo_messaging_notifications/transport_url').with( + :value => '') is_expected.to contain_cinder_config('oslo_messaging_notifications/driver').with( :value => 'messagingv2') end diff --git a/spec/classes/cinder_spec.rb b/spec/classes/cinder_spec.rb index 8028c4ce..08fe84e6 100644 --- a/spec/classes/cinder_spec.rb +++ b/spec/classes/cinder_spec.rb @@ -32,6 +32,7 @@ describe 'cinder' do end it 'should contain default config' do + is_expected.to contain_cinder_config('DEFAULT/transport_url').with(:value => '') is_expected.to contain_cinder_config('DEFAULT/rpc_backend').with(:value => 'rabbit') is_expected.to contain_cinder_config('DEFAULT/control_exchange').with(:value => 'openstack') is_expected.to contain_cinder_config('DEFAULT/report_interval').with(:value => '') @@ -329,4 +330,14 @@ describe 'cinder' do it { is_expected.to contain_cinder_config('DEFAULT/host').with_value('mystring') } end + + describe 'with transport_url' do + let :params do + req_params.merge({ + :default_transport_url => 'rabbit://rabbit_user:password@localhost:5673', + }) + end + + it { is_expected.to contain_cinder_config('DEFAULT/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') } + end end