From 7ecb339928afd0c6e17960b2561c73f552e5189b Mon Sep 17 00:00:00 2001 From: ZhongShengping Date: Wed, 7 Feb 2018 14:25:44 +0800 Subject: [PATCH] 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 --- README.md | 3 - examples/ceilometer_with_gnocchi.pp | 8 - examples/site.pp | 2 - manifests/api.pp | 120 ------------- ...ilometer-api-removal-1a35e07f23981735.yaml | 5 + spec/classes/ceilometer_api_spec.rb | 160 ------------------ 6 files changed, 5 insertions(+), 293 deletions(-) delete mode 100644 manifests/api.pp create mode 100644 releasenotes/notes/ceilometer-api-removal-1a35e07f23981735.yaml delete mode 100644 spec/classes/ceilometer_api_spec.rb diff --git a/README.md b/README.md index 498d9896..25272f95 100644 --- a/README.md +++ b/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 diff --git a/examples/ceilometer_with_gnocchi.pp b/examples/ceilometer_with_gnocchi.pp index 9fddaa91..ddf3cda6 100644 --- a/examples/ceilometer_with_gnocchi.pp +++ b/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'], diff --git a/examples/site.pp b/examples/site.pp index 9c029e07..1e86b774 100644 --- a/examples/site.pp +++ b/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': diff --git a/manifests/api.pp b/manifests/api.pp deleted file mode 100644 index 7a253c45..00000000 --- a/manifests/api.pp +++ /dev/null @@ -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, - } - -} diff --git a/releasenotes/notes/ceilometer-api-removal-1a35e07f23981735.yaml b/releasenotes/notes/ceilometer-api-removal-1a35e07f23981735.yaml new file mode 100644 index 00000000..b6380278 --- /dev/null +++ b/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. diff --git a/spec/classes/ceilometer_api_spec.rb b/spec/classes/ceilometer_api_spec.rb deleted file mode 100644 index 67e43925..00000000 --- a/spec/classes/ceilometer_api_spec.rb +++ /dev/null @@ -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('') - is_expected.to contain_ceilometer_config('oslo_middleware/enable_proxy_headers_parsing').with_value('') - 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