Browse Source

Remove ceilometer api class

The ceilometer api has been retired upstream and the class has been
previously deprecated. Since the package may be going away, we need to
remove the api class.

https://review.openstack.org/#/c/512286/

Change-Id: Idfffa36b17543968c14dfbc60eb1d9ff3286841b
Closes-Bug: #1747841
changes/62/541562/1
ZhongShengping 4 years ago
parent
commit
7ecb339928
  1. 3
      README.md
  2. 8
      examples/ceilometer_with_gnocchi.pp
  3. 2
      examples/site.pp
  4. 120
      manifests/api.pp
  5. 5
      releasenotes/notes/ceilometer-api-removal-1a35e07f23981735.yaml
  6. 160
      spec/classes/ceilometer_api_spec.rb

3
README.md

@ -65,9 +65,6 @@ class { '::ceilometer::keystone::authtoken':
password => 'a_big_secret',
auth_url => 'http://127.0.0.1:35357/',
}
class { '::ceilometer::api':
enabled => true,
}
```
Implementation

8
examples/ceilometer_with_gnocchi.pp

@ -19,14 +19,6 @@ class { '::ceilometer::agent::notification': }
class { '::ceilometer::keystone::authtoken':
password => 'a_big_secret',
}
class { '::ceilometer::api':
enabled => true,
service_name => 'httpd',
}
include ::apache
class { '::ceilometer::wsgi::apache':
ssl => false,
}
class { '::ceilometer::collector':
meter_dispatchers => ['gnocchi'],

2
examples/site.pp

@ -33,8 +33,6 @@ node default {
class { '::ceilometer::keystone::authtoken':
password => 'tralalayouyou'
}
# Install the ceilometer-api service
class { '::ceilometer::api': }
# Set common auth parameters used by all agents (compute/central)
class { '::ceilometer::agent::auth':

120
manifests/api.pp

@ -1,120 +0,0 @@
# == Class: ceilometer::api
#
# Installs & configure the Ceilometer api 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.
#
# [*host*]
# (Optional) The ceilometer api bind address.
# Defaults to '0.0.0.0'.
#
# [*port*]
# (Optional) The ceilometer api port.
# Defaults to 8777.
#
# [*package_ensure*]
# (Optional) ensure state for package.
# Defaults to 'present'.
#
# [*service_name*]
# (Optional) Name of the service that will be providing the
# server functionality of ceilometer-api.
# If the value is 'httpd', this means ceilometer-api will be a web
# service, and you must use another class to configure that
# web service. For example, use class { 'ceilometer::wsgi::apache'...}
# to make ceilometer-api be a web app using apache mod_wsgi.
# Defaults to '$::ceilometer::params::api_service_name'.
#
# [*api_workers*]
# (Optional) Number of workers for Ceilometer API server (integer value).
# Defaults to $::os_service_default.
#
# [*auth_strategy*]
# (Optional) Type of authentication to be used.
# Defaults to 'keystone'
#
# [*enable_proxy_headers_parsing*]
# (Optional) Enable paste middleware to handle SSL requests through
# HTTPProxyToWSGI middleware.
# Defaults to $::os_service_default.
#
class ceilometer::api (
$manage_service = true,
$enabled = true,
$package_ensure = 'present',
$host = '0.0.0.0',
$port = '8777',
$service_name = $::ceilometer::params::api_service_name,
$api_workers = $::os_service_default,
$auth_strategy = 'keystone',
$enable_proxy_headers_parsing = $::os_service_default,
) inherits ceilometer::params {
include ::ceilometer::deps
include ::ceilometer::params
include ::ceilometer::policy
warning('ceilometer-api has been deprecated in Ocata and will be removed in future. Please use Aodh, Gnocchi and Panko modules instead.')
if $auth_strategy == 'keystone' {
include ::ceilometer::keystone::authtoken
}
package { 'ceilometer-api':
ensure => $package_ensure,
name => $::ceilometer::params::api_package_name,
tag => ['openstack', 'ceilometer-package'],
}
if $manage_service {
if $enabled {
$service_ensure = 'running'
} else {
$service_ensure = 'stopped'
}
}
if $service_name == $::ceilometer::params::api_service_name {
service { 'ceilometer-api':
ensure => $service_ensure,
name => $::ceilometer::params::api_service_name,
enable => $enabled,
hasstatus => true,
hasrestart => true,
tag => 'ceilometer-service',
}
} elsif $service_name == 'httpd' {
include ::apache::params
service { 'ceilometer-api':
ensure => 'stopped',
name => $::ceilometer::params::api_service_name,
enable => false,
tag => 'ceilometer-service',
}
# we need to make sure ceilometer-api/eventlet is stopped before trying to start apache
Service['ceilometer-api'] -> Service[$service_name]
} else {
fail("Invalid service_name. Either ceilometer/openstack-ceilometer-api for \
running as a standalone service, or httpd for being run by a httpd server")
}
ceilometer_config {
'api/workers': value => $api_workers;
'api/host': value => $host;
'api/port': value => $port;
}
oslo::middleware { 'ceilometer_config':
enable_proxy_headers_parsing => $enable_proxy_headers_parsing,
}
}

5
releasenotes/notes/ceilometer-api-removal-1a35e07f23981735.yaml

@ -0,0 +1,5 @@
---
upgrade:
- |
Ceilometer api has been removed from the upstream so the ceilomter::api
class has been removed.

160
spec/classes/ceilometer_api_spec.rb

@ -1,160 +0,0 @@
require 'spec_helper'
describe 'ceilometer::api' do
let :pre_condition do
"class { 'ceilometer': telemetry_secret => 's3cr3t' }
include ::ceilometer::db
class { '::ceilometer::keystone::authtoken':
password => 'a_big_secret',
}"
end
let :params do
{ :enabled => true,
:manage_service => true,
:host => '0.0.0.0',
:port => '8777',
:package_ensure => 'latest',
}
end
shared_examples_for 'ceilometer-api' do
it { is_expected.to contain_class('ceilometer::deps') }
it { is_expected.to contain_class('ceilometer::params') }
it { is_expected.to contain_class('ceilometer::policy') }
it { is_expected.to contain_class('ceilometer::keystone::authtoken') }
it 'installs ceilometer-api package' do
is_expected.to contain_package('ceilometer-api').with(
:ensure => 'latest',
:name => platform_params[:api_package_name],
:tag => ['openstack', 'ceilometer-package'],
)
end
it 'configures api' do
is_expected.to contain_ceilometer_config('api/host').with_value( params[:host] )
is_expected.to contain_ceilometer_config('api/port').with_value( params[:port] )
is_expected.to contain_ceilometer_config('api/workers').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ceilometer_config('oslo_middleware/enable_proxy_headers_parsing').with_value('<SERVICE DEFAULT>')
end
[{:enabled => true}, {:enabled => false}].each do |param_hash|
context "when service should be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do
before do
params.merge!(param_hash)
end
it 'configures ceilometer-api service' do
is_expected.to contain_service('ceilometer-api').with(
:ensure => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped',
:name => platform_params[:api_service_name],
:enable => params[:enabled],
:hasstatus => true,
:hasrestart => true,
:tag => 'ceilometer-service',
)
end
it { is_expected.to contain_service('ceilometer-api').that_subscribes_to('Anchor[ceilometer::service::begin]')}
it { is_expected.to contain_service('ceilometer-api').that_notifies('Anchor[ceilometer::service::end]')}
end
end
context 'with enable_proxy_headers_parsing' do
before do
params.merge!({:enable_proxy_headers_parsing => true })
end
it { is_expected.to contain_ceilometer_config('oslo_middleware/enable_proxy_headers_parsing').with_value(true) }
end
context 'with disabled service managing' do
before do
params.merge!({
:manage_service => false,
:enabled => false })
end
it 'configures ceilometer-api service' do
is_expected.to contain_service('ceilometer-api').with(
:ensure => nil,
:name => platform_params[:api_service_name],
:enable => false,
:hasstatus => true,
:hasrestart => true,
:tag => 'ceilometer-service',
)
end
end
context 'when running ceilometer-api in wsgi' do
before do
params.merge!({ :service_name => 'httpd' })
end
let :pre_condition do
"include ::apache
include ::ceilometer::db
class { 'ceilometer': telemetry_secret => 's3cr3t' }
class { '::ceilometer::keystone::authtoken':
password => 'a_big_secret',
}"
end
it 'configures ceilometer-api service with Apache' do
is_expected.to contain_service('ceilometer-api').with(
:ensure => 'stopped',
:name => platform_params[:api_service_name],
:enable => false,
:tag => 'ceilometer-service',
)
end
end
context 'when service_name is not valid' do
before do
params.merge!({ :service_name => 'foobar' })
end
let :pre_condition do
"include ::apache
include ::ceilometer::db
class { 'ceilometer': telemetry_secret => 's3cr3t' }
class { '::ceilometer::keystone::authtoken':
password => 'a_big_secret',
}"
end
it_raises 'a Puppet::Error', /Invalid service_name/
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({
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'some.host.tld',
}))
end
let :platform_params do
case facts[:osfamily]
when 'Debian'
{ :api_package_name => 'ceilometer-api',
:api_service_name => 'ceilometer-api' }
when 'RedHat'
{ :api_package_name => 'openstack-ceilometer-api',
:api_service_name => 'openstack-ceilometer-api' }
end
end
it_behaves_like 'ceilometer-api'
end
end
end
Loading…
Cancel
Save