From a17104c6ad6993d73ffa0d72edb7a7a6e6cce14d Mon Sep 17 00:00:00 2001 From: rabi Date: Mon, 5 Feb 2018 12:03:37 +0530 Subject: [PATCH] Remove support for heat-api-cloudwatch service In 6d55417f80384ead56e176beec9e2fc4eb162d61 cloudwatch api has been removed from heat. Change-Id: I155c92edd5d6959ac23d99804fd95dfb99c7042e --- README.md | 2 - manifests/api_cloudwatch.pp | 139 ----------------- manifests/params.pp | 6 - manifests/wsgi/apache.pp | 8 +- manifests/wsgi/apache_api_cloudwatch.pp | 142 ------------------ ...-heat-api-cloudwatch-6f18e6eafce8932f.yaml | 5 + spec/acceptance/basic_heat_spec.rb | 8 - spec/classes/heat_api_cloudwatch_spec.rb | 137 ----------------- .../heat_wsgi_apache_api_cloudwatch_spec.rb | 41 ----- spec/defines/heat_wsgi_apache_spec.rb | 13 -- 10 files changed, 9 insertions(+), 492 deletions(-) delete mode 100644 manifests/api_cloudwatch.pp delete mode 100644 manifests/wsgi/apache_api_cloudwatch.pp create mode 100644 releasenotes/notes/remove-heat-api-cloudwatch-6f18e6eafce8932f.yaml delete mode 100644 spec/classes/heat_api_cloudwatch_spec.rb delete mode 100644 spec/classes/heat_wsgi_apache_api_cloudwatch_spec.rb diff --git a/README.md b/README.md index 6f93e055..cfd534aa 100644 --- a/README.md +++ b/README.md @@ -67,8 +67,6 @@ class { '::heat::engine': auth_encryption_key => '1234567890AZERTYUIOPMLKJHGFDSQ12', } -class { '::heat::api_cloudwatch': } - class { '::heat::api_cfn': } ``` diff --git a/manifests/api_cloudwatch.pp b/manifests/api_cloudwatch.pp deleted file mode 100644 index b75ff89e..00000000 --- a/manifests/api_cloudwatch.pp +++ /dev/null @@ -1,139 +0,0 @@ -# == Class: heat::api_cloudwatch -# -# This class deprecates heat::api-cloudwatch -# -# Installs & configure the heat CloudWatch API service -# -# === Parameters -# [*package_ensure*] -# (Optional) Ensure state for package. -# Defaults to 'present' -# -# [*enabled*] -# (optional) Should the service be enabled. -# Defaults to true. -# -# [*manage_service*] -# (optional) Whether the service should be managed by Puppet. -# Defaults to true. -# -# [*bind_host*] -# (Optional) Address to bind the server. Useful when -# selecting a particular network interface. -# Defaults to $::os_service_default. -# -# [*bind_port*] -# (Optional) The port on which the server will listen. -# Defaults to $::os_service_default. -# -# [*workers*] -# (Optional) The number of workers to spawn. -# Defaults to $::os_service_default. -# -# [*use_ssl*] -# (Optional) Whether to use ssl or not. -# Defaults to 'false'. -# -# [*cert_file*] -# (Optional) Location of the SSL certificate file to use for SSL mode. -# Required when $use_ssl is set to 'true'. -# Defaults to $::os_service_default. -# -# [*key_file*] -# (Optional) Location of the SSL key file to use for enabling SSL mode. -# Required when $use_ssl is set to 'true'. -# Defaults to $::os_service_default. -# -# [*service_name*] -# (optional) Name of the service that will be providing the -# server functionality of heat-api-cloudwatch. -# If the value is 'httpd', this means heat-api-cloudwatch will be a web -# service, and you must use another class to configure that -# web service. For example, use -# class{ 'heat::wsgi::apache_api_cloudwatch'...} to make heat-api-cloudwatch -# be a web app using apache mod_wsgi. -# Defaults to '$::heat::params::api_cloudwatch_service_name' -# -# == Deprecated Parameters -# -# No Deprecated Parameters. -# -class heat::api_cloudwatch ( - $package_ensure = 'present', - $manage_service = true, - $enabled = true, - $bind_host = $::os_service_default, - $bind_port = $::os_service_default, - $workers = $::os_service_default, - $use_ssl = false, - $cert_file = $::os_service_default, - $key_file = $::os_service_default, - $service_name = $::heat::params::api_cloudwatch_service_name, -) inherits heat::params { - - include ::heat - include ::heat::deps - include ::heat::params - include ::heat::policy - - if $use_ssl { - if is_service_default($cert_file) { - fail('The cert_file parameter is required when use_ssl is set to true') - } - if is_service_default($key_file) { - fail('The key_file parameter is required when use_ssl is set to true') - } - } - - package { 'heat-api-cloudwatch': - ensure => $package_ensure, - name => $::heat::params::api_cloudwatch_package_name, - tag => ['openstack', 'heat-package'], - } - - if $manage_service { - if $enabled { - $service_ensure = 'running' - } else { - $service_ensure = 'stopped' - } - } - - if $service_name == $::heat::params::api_cloudwatch_service_name { - service { 'heat-api-cloudwatch': - ensure => $service_ensure, - name => $::heat::params::api_cloudwatch_service_name, - enable => $enabled, - hasstatus => true, - hasrestart => true, - tag => 'heat-service', - } - } elsif $service_name == 'httpd' { - include ::apache::params - service { 'heat-api-cloudwatch': - ensure => 'stopped', - name => $::heat::params::api_cloudwatch_service_name, - enable => false, - tag => ['heat-service'], - } - - # we need to make sure heat-api-cloudwatch/eventlet is stopped before trying to start apache - Service['heat-api-cloudwatch'] -> Service[$service_name] - } else { - fail("Invalid service_name. Either heat-api-cloudwatch/openstack-heat-api-cloudwatch for \ -running as a standalone service, or httpd for being run by a httpd server") - } - - heat_config { - 'heat_api_cloudwatch/bind_host': value => $bind_host; - 'heat_api_cloudwatch/bind_port': value => $bind_port; - 'heat_api_cloudwatch/workers': value => $workers; - } - - if $use_ssl { - heat_config { - 'heat_api_cloudwatch/cert_file': value => $cert_file; - 'heat_api_cloudwatch/key_file': value => $key_file; - } - } -} diff --git a/manifests/params.pp b/manifests/params.pp index 91ed9d40..57acf111 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -12,38 +12,32 @@ class heat::params { 'RedHat': { # package names $api_package_name = 'openstack-heat-api' - $api_cloudwatch_package_name = 'openstack-heat-api-cloudwatch' $api_cfn_package_name = 'openstack-heat-api-cfn' $engine_package_name = 'openstack-heat-engine' $common_package_name = 'openstack-heat-common' # service names $api_service_name = 'openstack-heat-api' - $api_cloudwatch_service_name = 'openstack-heat-api-cloudwatch' $api_cfn_service_name = 'openstack-heat-api-cfn' $engine_service_name = 'openstack-heat-engine' # WSGI scripts $heat_wsgi_script_path = '/var/www/cgi-bin/heat' $heat_api_wsgi_script_source = '/usr/bin/heat-wsgi-api' $heat_api_cfn_wsgi_script_source = '/usr/bin/heat-wsgi-api-cfn' - $heat_api_cloudwatch_wsgi_script_source = '/usr/bin/heat-wsgi-api-cloudwatch' } 'Debian': { # package names $api_package_name = 'heat-api' - $api_cloudwatch_package_name = 'heat-api-cloudwatch' $api_cfn_package_name = 'heat-api-cfn' $engine_package_name = 'heat-engine' $common_package_name = 'heat-common' # service names $api_service_name = 'heat-api' - $api_cloudwatch_service_name = 'heat-api-cloudwatch' $api_cfn_service_name = 'heat-api-cfn' $engine_service_name = 'heat-engine' # WSGI scripts $heat_wsgi_script_path = '/usr/lib/cgi-bin/heat' $heat_api_wsgi_script_source = '/usr/bin/heat-wsgi-api' $heat_api_cfn_wsgi_script_source = '/usr/bin/heat-wsgi-api-cfn' - $heat_api_cloudwatch_wsgi_script_source = '/usr/bin/heat-wsgi-api-cloudwatch' # Operating system specific case $::operatingsystem { 'Ubuntu': { diff --git a/manifests/wsgi/apache.pp b/manifests/wsgi/apache.pp index 4581d563..a361ac3d 100644 --- a/manifests/wsgi/apache.pp +++ b/manifests/wsgi/apache.pp @@ -13,7 +13,7 @@ # # Resource to serve Heat API with apache mod_wsgi in place of heat-api service. # -# This is useful for the main API as well as the CFN and Cloudwatch APIs. +# This is useful for the main API as well as the CFN API. # Serving Heat API from apache is the recommended way to go for production # because of limited performance for concurrent accesses when running eventlet. # @@ -23,7 +23,7 @@ # # [*title*] # The heat API that will be running over this vhost. -# The valid options are "api", "api_cfn" and "api_cloudwatch" +# The valid options are "api" and "api_cfn" # # [*port*] # The port for the specific API. @@ -126,8 +126,8 @@ define heat::wsgi::apache ( $custom_wsgi_process_options = {}, $wsgi_process_display_name = undef, ) { - if $title !~ /^api(|_cfn|_cloudwatch)$/ { - fail('The valid options are api, api_cfn, api_cloudwatch') + if $title !~ /^api(|_cfn)$/ { + fail('The valid options are api, api_cfn') } include ::heat::deps include ::heat::params diff --git a/manifests/wsgi/apache_api_cloudwatch.pp b/manifests/wsgi/apache_api_cloudwatch.pp deleted file mode 100644 index d382f4f9..00000000 --- a/manifests/wsgi/apache_api_cloudwatch.pp +++ /dev/null @@ -1,142 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -# Resource to serve Heat API with apache mod_wsgi in place of heat-api service. -# -# Serving Heat API from apache is the recommended way to go for production -# because of limited performance for concurrent accesses when running eventlet. -# -# When using this class you should disable your heat-api service. -# -# == Parameters -# -# [*port*] -# The port for the specific API. -# -# [*servername*] -# The servername for the virtualhost. -# Optional. Defaults to $::fqdn -# -# [*bind_host*] -# The host/ip address Apache will listen on. -# Optional. Defaults to undef (listen on all ip addresses). -# -# [*path*] -# The prefix for the endpoint. -# Optional. Defaults to '/' -# -# [*ssl*] -# Use ssl ? (boolean) -# Optional. Defaults to true -# -# [*workers*] -# Number of WSGI workers to spawn. -# Optional. Defaults to $::os_workers -# -# [*priority*] -# (optional) The priority for the vhost. -# Defaults to '10' -# -# [*threads*] -# (optional) The number of threads for the vhost. -# Defaults to 1 -# -# [*ssl_cert*] -# [*ssl_key*] -# [*ssl_chain*] -# [*ssl_ca*] -# [*ssl_crl_path*] -# [*ssl_crl*] -# [*ssl_certs_dir*] -# apache::vhost ssl parameters. -# Optional. Default to apache::vhost 'ssl_*' defaults. -# -# [*access_log_file*] -# The log file name for the virtualhost. -# Optional. Defaults to false. -# -# [*access_log_format*] -# The log format for the virtualhost. -# Optional. Defaults to false. -# -# [*error_log_file*] -# The error log file name for the virtualhost. -# Optional. Defaults to undef. -# -# [*custom_wsgi_process_options*] -# (optional) gives you the oportunity to add custom process options or to -# overwrite the default options for the WSGI main process. -# eg. to use a virtual python environment for the WSGI process -# you could set it to: -# { python-path => '/my/python/virtualenv' } -# Defaults to {} -# -# [*wsgi_process_display_name*] -# (optional) Name of the WSGI process display-name. -# Defaults to undef -# -# == Dependencies -# -# requires Class['apache'] & Class['heat'] -# -# == Examples -# -# include apache -# -# class { 'heat::wsgi::apache': } -# -class heat::wsgi::apache_api_cloudwatch ( - $port = 8003, - $servername = $::fqdn, - $bind_host = undef, - $path = '/', - $ssl = true, - $workers = $::os_workers, - $ssl_cert = undef, - $ssl_key = undef, - $ssl_chain = undef, - $ssl_ca = undef, - $ssl_crl_path = undef, - $ssl_crl = undef, - $ssl_certs_dir = undef, - $threads = 1, - $priority = '10', - $access_log_file = false, - $access_log_format = false, - $error_log_file = undef, - $custom_wsgi_process_options = {}, - $wsgi_process_display_name = undef, -) { - heat::wsgi::apache { 'api_cloudwatch': - port => $port, - servername => $servername, - bind_host => $bind_host, - path => $path, - ssl => $ssl, - workers => $workers, - ssl_cert => $ssl_cert, - ssl_key => $ssl_key, - ssl_chain => $ssl_chain, - ssl_ca => $ssl_ca, - ssl_crl_path => $ssl_crl_path, - ssl_crl => $ssl_crl, - ssl_certs_dir => $ssl_certs_dir, - threads => $threads, - priority => $priority, - custom_wsgi_process_options => $custom_wsgi_process_options, - access_log_file => $access_log_file, - access_log_format => $access_log_format, - error_log_file => $error_log_file, - wsgi_process_display_name => $wsgi_process_display_name, - } -} diff --git a/releasenotes/notes/remove-heat-api-cloudwatch-6f18e6eafce8932f.yaml b/releasenotes/notes/remove-heat-api-cloudwatch-6f18e6eafce8932f.yaml new file mode 100644 index 00000000..56d22b5a --- /dev/null +++ b/releasenotes/notes/remove-heat-api-cloudwatch-6f18e6eafce8932f.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - | + Remove support for heat-api-cloudwatch service. It's been + removed from heat since Queens release. diff --git a/spec/acceptance/basic_heat_spec.rb b/spec/acceptance/basic_heat_spec.rb index cb27ddfe..b83c9a73 100644 --- a/spec/acceptance/basic_heat_spec.rb +++ b/spec/acceptance/basic_heat_spec.rb @@ -54,10 +54,6 @@ describe 'basic heat' do class { '::heat::engine': auth_encryption_key => '1234567890AZERTYUIOPMLKJHGFDSQ12', } - class { '::heat::api_cloudwatch': - service_name => 'httpd', - } - include ::heat::wsgi::apache_api_cloudwatch class { '::heat::api_cfn': service_name => 'httpd', } @@ -75,10 +71,6 @@ describe 'basic heat' do it { is_expected.to be_listening } end - describe port(8003) do - it { is_expected.to be_listening } - end - describe port(8004) do it { is_expected.to be_listening } end diff --git a/spec/classes/heat_api_cloudwatch_spec.rb b/spec/classes/heat_api_cloudwatch_spec.rb deleted file mode 100644 index 9aaf45e6..00000000 --- a/spec/classes/heat_api_cloudwatch_spec.rb +++ /dev/null @@ -1,137 +0,0 @@ -require 'spec_helper' - -describe 'heat::api_cloudwatch' do - - let :params do - { :enabled => true, - :manage_service => true, - :bind_host => '127.0.0.1', - :bind_port => '1234', - :workers => '0' } - end - - - shared_examples_for 'heat-api-cloudwatch' do - let :pre_condition do - "class { 'heat::keystone::authtoken': - password => 'a_big_secret', - }" - end - - context 'config params' do - - it { is_expected.to contain_class('heat') } - it { is_expected.to contain_class('heat::params') } - it { is_expected.to contain_class('heat::policy') } - - it { is_expected.to contain_heat_config('heat_api_cloudwatch/bind_host').with_value( params[:bind_host] ) } - it { is_expected.to contain_heat_config('heat_api_cloudwatch/bind_port').with_value( params[:bind_port] ) } - it { is_expected.to contain_heat_config('heat_api_cloudwatch/workers').with_value( params[:workers] ) } - - end - - context 'with SSL socket options set' do - let :params do - { - :use_ssl => true, - :cert_file => '/path/to/cert', - :key_file => '/path/to/key' - } - end - - it { is_expected.to contain_heat_config('heat_api_cloudwatch/cert_file').with_value('/path/to/cert') } - it { is_expected.to contain_heat_config('heat_api_cloudwatch/key_file').with_value('/path/to/key') } - end - - context 'with SSL socket options set with wrong parameters' do - let :params do - { - :use_ssl => true, - :key_file => '/path/to/key' - } - end - - it_raises 'a Puppet::Error', /The cert_file parameter is required when use_ssl is set to true/ - 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 heat-api-cloudwatch service' do - - is_expected.to contain_service('heat-api-cloudwatch').with( - :ensure => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped', - :name => platform_params[:api_cloudwatch_service_name], - :enable => params[:enabled], - :hasstatus => true, - :hasrestart => true, - :tag => 'heat-service', - ) - is_expected.to contain_service('heat-api-cloudwatch').that_subscribes_to(nil) - end - end - end - - context 'with disabled service managing' do - before do - params.merge!({ - :manage_service => false, - :enabled => false }) - end - - it 'configures heat-api-cloudwatch service' do - - is_expected.to contain_service('heat-api-cloudwatch').with( - :ensure => nil, - :name => platform_params[:api_cloudwatch_service_name], - :enable => false, - :hasstatus => true, - :hasrestart => true, - :tag => 'heat-service', - ) - is_expected.to contain_service('heat-api-cloudwatch').that_subscribes_to(nil) - end - end - - context 'with $sync_db set to false in ::heat' do - let :pre_condition do - "class { '::heat::keystone::authtoken': - password => 'a_big_secret', - } - class {'heat': - sync_db => false - }" - end - - it 'configures heat-api-cloudwatch service to not subscribe to the dbsync resource' do - is_expected.to contain_service('heat-api-cloudwatch').that_subscribes_to(nil) - 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' - { :api_cloudwatch_service_name => 'heat-api-cloudwatch' } - when 'RedHat' - { :api_cloudwatch_service_name => 'openstack-heat-api-cloudwatch' } - end - end - - it_behaves_like 'heat-api-cloudwatch' - end - end - -end diff --git a/spec/classes/heat_wsgi_apache_api_cloudwatch_spec.rb b/spec/classes/heat_wsgi_apache_api_cloudwatch_spec.rb deleted file mode 100644 index 93dfd86a..00000000 --- a/spec/classes/heat_wsgi_apache_api_cloudwatch_spec.rb +++ /dev/null @@ -1,41 +0,0 @@ -require 'spec_helper' - -describe 'heat::wsgi::apache_api_cloudwatch' do - - shared_examples_for 'heat::wsgi::apache_api_cloudwatch' do - context 'default parameters' do - it { is_expected.to contain_class('heat::wsgi::apache_api_cloudwatch') } - it { is_expected.to contain_heat__wsgi__apache('api_cloudwatch').with( - :port => 8003, - :servername => facts[:fqdn], - :bind_host => nil, - :path => '/', - :ssl => true, - :workers => facts[:os_workers], - :ssl_cert => nil, - :ssl_key => nil, - :ssl_chain => nil, - :ssl_ca => nil, - :ssl_crl_path => nil, - :ssl_certs_dir => nil, - :wsgi_process_display_name => nil, - :threads => 1, - :priority => 10, - :custom_wsgi_process_options => {}, ) - } - 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_configures 'heat::wsgi::apache_api_cloudwatch' - end - end - -end diff --git a/spec/defines/heat_wsgi_apache_spec.rb b/spec/defines/heat_wsgi_apache_spec.rb index fbbf4a79..4e2adc9d 100644 --- a/spec/defines/heat_wsgi_apache_spec.rb +++ b/spec/defines/heat_wsgi_apache_spec.rb @@ -66,17 +66,6 @@ describe 'heat::wsgi::apache' do )} end - context 'with cloudwatch options' do - let (:title) { 'api_cloudwatch' } - it { is_expected.to contain_openstacklib__wsgi__apache("heat_#{title}_wsgi").with( - 'wsgi_daemon_process' => "heat_#{title}", - 'wsgi_process_group' => "heat_#{title}", - 'wsgi_script_dir' => platform_params[:wsgi_script_dir], - 'wsgi_script_file' => "heat_#{title}", - 'wsgi_script_source' => platform_params[:script_source_cloudwatch], - )} - end - end context 'invalid title' do @@ -101,7 +90,6 @@ describe 'heat::wsgi::apache' do :wsgi_script_dir => '/usr/lib/cgi-bin/heat', :script_source_api => '/usr/bin/heat-wsgi-api', :script_source_cfn => '/usr/bin/heat-wsgi-api-cfn', - :script_source_cloudwatch => '/usr/bin/heat-wsgi-api-cloudwatch', } when 'RedHat' { :httpd_service_name => 'httpd', @@ -109,7 +97,6 @@ describe 'heat::wsgi::apache' do :wsgi_script_dir => '/var/www/cgi-bin/heat', :script_source_api => '/usr/bin/heat-wsgi-api', :script_source_cfn => '/usr/bin/heat-wsgi-api-cfn', - :script_source_cloudwatch => '/usr/bin/heat-wsgi-api-cloudwatch', } end end