diff --git a/manifests/agent/polling.pp b/manifests/agent/polling.pp index 667f6afd..f5b2a9e2 100644 --- a/manifests/agent/polling.pp +++ b/manifests/agent/polling.pp @@ -28,10 +28,6 @@ # (Optional) Use ipmi namespace for polling agent. # Defaults to true. # -# [*coordination_url*] -# (Optional) The url to use for distributed group membership coordination. -# Defaults to $::os_service_default. -# # [*instance_discovery_method*] # (Optional) method to discovery instances running on compute node # Defaults to $::os_service_default @@ -58,6 +54,12 @@ # This is used only if manage_polling is true. # Defaults to undef # +# DEPRECATED PARAMETERS +# +# [*coordination_url*] +# (Optional) The url to use for distributed group membership coordination. +# Defaults to undef. +# class ceilometer::agent::polling ( $manage_service = true, $enabled = true, @@ -65,17 +67,23 @@ class ceilometer::agent::polling ( $central_namespace = true, $compute_namespace = true, $ipmi_namespace = true, - $coordination_url = $::os_service_default, $instance_discovery_method = $::os_service_default, $manage_polling = false, $polling_interval = 600, $polling_meters = $::ceilometer::params::polling_meters, $polling_config = undef, + # DEPRECATED PARAMETERS + $coordination_url = undef, ) inherits ceilometer { include ceilometer::deps include ceilometer::params + if $coordination_url != undef { + warning('The coordination_url parameter has been deprecated. Use ceilometer::coordination instead') + include ceilometer::coordination + } + if $central_namespace { $central_namespace_name = 'central' } else { @@ -144,17 +152,6 @@ class ceilometer::agent::polling ( tag => 'ceilometer-service', } - if $coordination_url == undef { - warning('Usage of undef for the coordination_url parameter has been deprecated. \ -Use $::os_service_default instead') - $coordination_url_real = $::os_service_default - } else { - $coordination_url_real = $coordination_url - } - ceilometer_config { - 'coordination/backend_url': value => $coordination_url_real - } - if $manage_polling { if $polling_config { validate_legacy(Hash, 'validate_hash', $polling_config) diff --git a/manifests/coordination.pp b/manifests/coordination.pp new file mode 100644 index 00000000..2bc8127f --- /dev/null +++ b/manifests/coordination.pp @@ -0,0 +1,22 @@ +# == Class: ceilometer::coordination +# +# Setup and configure Ceilometer coordination settings. +# +# === Parameters +# +# [*backend_url*] +# (Optional) Coordination backend URL. +# Defaults to $::os_service_default +# +class ceilometer::coordination ( + $backend_url = $::os_service_default, +) { + + include ceilometer::deps + + $backend_url_real = pick($::ceilometer::agent::polling::coordination_url, $backend_url) + + oslo::coordination{ 'ceilometer_config': + backend_url => $backend_url_real + } +} diff --git a/releasenotes/notes/coordination-6e5105e0558f3e5b.yaml b/releasenotes/notes/coordination-6e5105e0558f3e5b.yaml new file mode 100644 index 00000000..d1eedcb2 --- /dev/null +++ b/releasenotes/notes/coordination-6e5105e0558f3e5b.yaml @@ -0,0 +1,9 @@ +--- +features: + - | + The new ``ceilometer::coordination`` class has been added. + +deprecations: + - | + The ``ceilometer::agent::polling::coordination_url`` parameter has been + deprecated in favor of the new ``ceilometer::coordination`` class. diff --git a/spec/classes/ceilometer_agent_polling_spec.rb b/spec/classes/ceilometer_agent_polling_spec.rb index 6b5c3deb..fcd908fa 100644 --- a/spec/classes/ceilometer_agent_polling_spec.rb +++ b/spec/classes/ceilometer_agent_polling_spec.rb @@ -48,7 +48,6 @@ describe 'ceilometer::agent::polling' do :tag => 'ceilometer-service', )} - it { should contain_ceilometer_config('coordination/backend_url').with_value('') } it { should_not contain_file('polling') } end diff --git a/spec/classes/ceilometer_coordination_spec.rb b/spec/classes/ceilometer_coordination_spec.rb new file mode 100644 index 00000000..91b2b52b --- /dev/null +++ b/spec/classes/ceilometer_coordination_spec.rb @@ -0,0 +1,39 @@ +require 'spec_helper' + +describe 'ceilometer::coordination' do + shared_examples 'ceilometer::coordination' do + context 'with default parameters' do + it { + is_expected.to contain_oslo__coordination('ceilometer_config').with( + :backend_url => '' + ) + } + end + + context 'with specified parameters' do + let :params do + { + :backend_url => 'etcd3+http://127.0.0.1:2379', + } + end + + it { + is_expected.to contain_oslo__coordination('ceilometer_config').with( + :backend_url => 'etcd3+http://127.0.0.1:2379' + ) + } + end + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge(OSDefaults.get_facts()) + end + + it_behaves_like 'ceilometer::coordination' + end + end +end