Browse Source

Remove deprecated collector classes

Collector has been deprecated in the previous release and is
targeted to be remvoed in Queens release. The code for this
is already removed upstream[1]. Let drop this class now.

[1] https://review.openstack.org/#/c/504244/

Change-Id: I626d50677255b9668ddec30131f6214f18d42fd7
changes/37/512337/3
Pradeep Kilambi 5 years ago
parent
commit
e2928d2d4c
  1. 124
      manifests/collector.pp
  2. 4
      manifests/params.pp
  3. 5
      releasenotes/notes/remove-collector-9547e7929e1a139f.yaml
  4. 139
      spec/classes/ceilometer_collector_spec.rb

124
manifests/collector.pp

@ -1,124 +0,0 @@
# == Class: ceilometer::params
#
# Installs the ceilometer collector service
#
# === Parameters:
#
# [*enabled*]
# (Optional) Should the service be enabled.
# Defaults to true.
#
# [*manage_service*]
# (Optional) Whether the service should be managed by Puppet.
# Defaults to true.
#
# [*package_ensure*]
# (Optional) ensure state for package.
# Defaults to 'present'.
#
# [*udp_address*]
# (Optional) the ceilometer collector udp bind address.
# Set it empty to disable the collector listener.
# Defaults to '0.0.0.0'.
#
# [*udp_port*]
# (Optional) the ceilometer collector udp bind port.
# Defaults to '4952'.
#
# [*meter_dispatchers*]
# (Optional) dispatcher driver(s) to process meter data.
# Can be an array or a string.
# Defaults to $::os_service_default.
#
# [*event_dispatchers*]
# (Optional) dispatcher driver(s) to process event data.
# Can be an array or a string.
# Defaults to $::os_service_default.
#
# [*collector_workers*]
# (Optional) Number of workers for collector service (integer value).
# Defaults to $::os_service_default.
#
# DEPRECATED PARAMETERS
#
# [*meter_dispatcher*]
# (Optional) dispatcher driver(s) to process meter data.
# Can be an array or a string.
# Defaults to undef.
#
# [*event_dispatcher*]
# (Optional) dispatcher driver(s) to process event data.
# Can be an array or a string.
# Defaults to undef.
#
class ceilometer::collector (
$manage_service = true,
$enabled = true,
$package_ensure = 'present',
$udp_address = '0.0.0.0',
$udp_port = '4952',
$collector_workers = $::os_service_default,
$meter_dispatchers = $::os_service_default,
$event_dispatchers = $::os_service_default,
# DEPRECATED PARAMETERS
$meter_dispatcher = undef,
$event_dispatcher = undef,
) {
include ::ceilometer::deps
include ::ceilometer::params
warning('This class is deprecated. Now the pipeline.yaml can be configured directly to send data eg: gnocchi://')
# We accept udp_address to be set to empty instead of the usual undef to stay
# close to the "strange" upstream interface.
if (is_ip_address($udp_address) != true and $udp_address != '' ){
fail("${udp_address} is not a valid ip and is not empty")
}
if $meter_dispatcher {
warning('The meter_dispatcher parameter is deprecated, please use meter_dispatchers instead.')
$meter_dispatchers_real = $meter_dispatcher
} else {
$meter_dispatchers_real = $meter_dispatchers
}
if $event_dispatcher {
warning('The event_dispatcher parameter is deprecated, please use event_dispatchers instead.')
$event_dispatchers_real = $event_dispatcher
} else {
$event_dispatchers_real = $event_dispatchers
}
ceilometer_config {
'collector/udp_address': value => $udp_address;
'collector/udp_port': value => $udp_port;
'collector/workers': value => $collector_workers;
'DEFAULT/meter_dispatchers': value => any2array($meter_dispatchers_real);
'DEFAULT/event_dispatchers': value => any2array($event_dispatchers_real);
}
ensure_resource( 'package', [$::ceilometer::params::collector_package_name],
{
ensure => $package_ensure,
tag => ['openstack', 'ceilometer-package']
}
)
if $manage_service {
if $enabled {
$service_ensure = 'running'
} else {
$service_ensure = 'stopped'
}
}
service { 'ceilometer-collector':
ensure => $service_ensure,
name => $::ceilometer::params::collector_service_name,
enable => $enabled,
hasstatus => true,
hasrestart => true,
tag => 'ceilometer-service'
}
}

4
manifests/params.pp

@ -21,7 +21,6 @@ class ceilometer::params {
$agent_compute_package_name = 'openstack-ceilometer-compute'
$agent_polling_package_name = 'openstack-ceilometer-polling'
$api_package_name = 'openstack-ceilometer-api'
$collector_package_name = 'openstack-ceilometer-collector'
$agent_notification_package_name = 'openstack-ceilometer-notification'
$common_package_name = 'openstack-ceilometer-common'
# service names
@ -29,7 +28,6 @@ class ceilometer::params {
$agent_compute_service_name = 'openstack-ceilometer-compute'
$agent_polling_service_name = 'openstack-ceilometer-polling'
$api_service_name = 'openstack-ceilometer-api'
$collector_service_name = 'openstack-ceilometer-collector'
$agent_notification_service_name = 'openstack-ceilometer-notification'
$ceilometer_wsgi_script_path = '/var/www/cgi-bin/ceilometer'
$ceilometer_wsgi_script_source = '/usr/lib/python2.7/site-packages/ceilometer/api/app.wsgi'
@ -41,14 +39,12 @@ class ceilometer::params {
$agent_compute_package_name = 'ceilometer-agent-compute'
$agent_polling_package_name = 'ceilometer-polling'
$api_package_name = 'ceilometer-api'
$collector_package_name = 'ceilometer-collector'
$agent_notification_package_name = 'ceilometer-agent-notification'
$common_package_name = 'ceilometer-common'
# service names
$agent_central_service_name = 'ceilometer-agent-central'
$agent_compute_service_name = 'ceilometer-agent-compute'
$agent_polling_service_name = 'ceilometer-polling'
$collector_service_name = 'ceilometer-collector'
$api_service_name = 'ceilometer-api'
$agent_notification_service_name = 'ceilometer-agent-notification'
$libvirt_group = 'libvirt'

5
releasenotes/notes/remove-collector-9547e7929e1a139f.yaml

@ -0,0 +1,5 @@
---
fixes:
- |
Ceilometer collector has been deprecated in the previous release. Let's
remove this service as the code upstream has been removed.

139
spec/classes/ceilometer_collector_spec.rb

@ -1,139 +0,0 @@
require 'spec_helper'
describe 'ceilometer::collector' do
let :pre_condition do
"class { 'ceilometer': telemetry_secret => 's3cr3t' }"
end
shared_examples_for 'ceilometer-collector' do
context 'when invalid ip is passed' do
let :params do
{ :udp_address => '300.0.0.0' }
end
it 'should fail' do
is_expected.to raise_error(Puppet::Error, /is not a valid ip and is not empty/)
end
end
context 'when a valid ipv6 is passed' do
before do
pre_condition << "class { 'ceilometer::db': }"
end
let :params do
{ :udp_address => '::1' }
end
it 'shouldn\'t fail' do
is_expected.to_not raise_error
end
end
context 'when an empty string passed' do
before do
pre_condition << "class { 'ceilometer::db': }"
end
let :params do
{ :udp_address => '' }
end
it 'should disable the listener' do
is_expected.to contain_ceilometer_config('collector/udp_address').with_value( '' )
end
end
context 'when enabled' do
before do
pre_condition << "class { 'ceilometer::db': }"
end
it { is_expected.to contain_class('ceilometer::params') }
it 'configures ceilometer-collector server' do
is_expected.to contain_ceilometer_config('collector/udp_address').with_value( '0.0.0.0' )
is_expected.to contain_ceilometer_config('collector/udp_port').with_value( '4952' )
is_expected.to contain_ceilometer_config('collector/workers').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ceilometer_config('DEFAULT/meter_dispatchers').with_value( ['<SERVICE DEFAULT>'] )
is_expected.to contain_ceilometer_config('DEFAULT/event_dispatchers').with_value( ['<SERVICE DEFAULT>'] )
end
it 'installs ceilometer-collector package' do
is_expected.to contain_package(platform_params[:collector_package_name]).with(
:ensure => 'present'
)
end
it 'configures ceilometer-collector service' do
is_expected.to contain_service('ceilometer-collector').with(
:ensure => 'running',
:name => platform_params[:collector_service_name],
:enable => true,
:hasstatus => true,
:hasrestart => true,
:tag => 'ceilometer-service'
)
end
end
context 'when disabled' do
let :params do
{ :enabled => false }
end
# Catalog compilation does not crash for lack of ceilometer::db
it { is_expected.to compile }
it 'configures ceilometer-collector service' do
is_expected.to contain_service('ceilometer-collector').with(
:ensure => 'stopped',
:name => platform_params[:collector_service_name],
:enable => false,
:hasstatus => true,
:hasrestart => true,
:tag => 'ceilometer-service'
)
end
end
context 'when service management is disabled' do
let :params do
{ :enabled => false,
:manage_service => false }
end
it 'configures ceilometer-collector service' do
is_expected.to contain_service('ceilometer-collector').with(
:ensure => nil,
:name => platform_params[:collector_service_name],
:enable => false,
:hasstatus => true,
:hasrestart => true,
:tag => 'ceilometer-service'
)
end
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
let :platform_params do
case facts[:osfamily]
when 'Debian'
{ :collector_package_name => 'ceilometer-collector',
:collector_service_name => 'ceilometer-collector' }
when 'RedHat'
{ :collector_package_name => 'openstack-ceilometer-collector',
:collector_service_name => 'openstack-ceilometer-collector' }
end
end
it_behaves_like 'ceilometer-collector'
end
end
end
Loading…
Cancel
Save