Remove Class nova::wsgi::apache

nova::wsgi::apache is deprecated and will be removed in a future release,
please use nova::wsgi::apache_api.

Change-Id: I591cd8032032eacee41d3877231c4e639d7bf0e4
This commit is contained in:
zhangyangyang 2017-10-06 20:02:12 +08:00
parent 8aa8426794
commit dfd4eeb579
3 changed files with 5 additions and 261 deletions

View File

@ -1,137 +0,0 @@
#
# Copyright (C) 2015 eNovance SAS <licensing@enovance.com>
#
# Author: Emilien Macchi <emilien.macchi@enovance.com>
#
# 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.
#
# Deprecated Class to serve Nova API and EC2 with apache mod_wsgi in place of nova-api and nova-api-ec2 services.
# Use ::nova::wsgi::apache::api.
#
# Serving Nova API and Nova API EC2 from apache is the recommended way to go for production
# because of limited performance for concurrent accesses.
#
# When using this class you should disable your nova-api and nova-api-ec2 service.
#
# == Parameters
#
# [*servername*]
# The servername for the virtualhost.
# Optional. Defaults to $::fqdn
#
# [*api_port*]
# The port for Nova API service.
# Optional. Defaults to 8774
#
# [*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 1
#
# [*priority*]
# (optional) The priority for the vhost.
# Defaults to '10'
#
# [*threads*]
# (optional) The number of threads for the vhost.
# Defaults to $::os_workers
#
# [*wsgi_process_display_name*]
# (optional) Name of the WSGI process display-name.
# Defaults to undef
#
# [*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.
#
# == Dependencies
#
# requires Class['apache'] & Class['nova'] & Class['nova::api']
#
# == Examples
#
# include apache
#
# class { 'nova::wsgi::apache': }
#
# Note: we can't transform this class in a define for backward compatibility.
# though this class might become a define in the future.
class nova::wsgi::apache (
$servername = $::fqdn,
$api_port = 8774,
$bind_host = undef,
$path = '/',
$ssl = true,
$workers = 1,
$ssl_cert = undef,
$ssl_key = undef,
$ssl_chain = undef,
$ssl_ca = undef,
$ssl_crl_path = undef,
$ssl_crl = undef,
$ssl_certs_dir = undef,
$wsgi_process_display_name = undef,
$threads = $::os_workers,
$priority = '10',
) {
include ::nova::params
include ::apache
include ::apache::mod::wsgi
if $ssl {
include ::apache::mod::ssl
}
if ! defined(Class[::nova::api]) {
fail('::nova::api class must be declared in composition layer.')
}
warning('nova::wsgi::apache is deprecated and will be removed in a future release, please use nova::wsgi::apache_api')
class { '::nova::wsgi::apache_api':
servername => $servername,
api_port => $api_port,
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,
wsgi_process_display_name => $wsgi_process_display_name,
threads => $threads,
priority => $priority,
}
}

View File

@ -0,0 +1,5 @@
---
upgrade:
- Remove Class nova::wsgi::apache
nova::wsgi::apache is deprecated and will be removed in a future release,
please use nova::wsgi::apache_api.

View File

@ -1,124 +0,0 @@
# This class is deprecated, we'll remove the test in a future release.
require 'spec_helper'
describe 'nova::wsgi::apache' do
let :pre_condition do
"include nova
class { '::nova::keystone::authtoken':
password => 'secrete',
}
class { '::nova::api':
service_name => 'httpd',
}"
end
shared_examples_for 'apache serving nova with mod_wsgi' do
context 'with default parameters' do
let :pre_condition do
"include nova
class { '::nova::keystone::authtoken':
password => 'secrete',
}
class { '::nova::api':
service_name => 'httpd',
}"
end
it { is_expected.to contain_class('nova::params') }
it { is_expected.to contain_class('apache') }
it { is_expected.to contain_class('apache::mod::wsgi') }
it { is_expected.to contain_class('apache::mod::ssl') }
it { is_expected.to contain_class('nova::wsgi::apache_api').with(
:servername => facts[:fqdn],
:api_port => 8774,
:path => '/',
:ssl => true,
:workers => 1,
:threads => facts[:os_workers],
:priority => '10',
)}
end
context 'when overriding parameters using different ports' do
let :pre_condition do
"include nova
class { '::nova::keystone::authtoken':
password => 'secrete',
}
class { '::nova::api':
service_name => 'httpd',
}"
end
let :params do
{
:servername => 'dummy.host',
:bind_host => '10.42.51.1',
:api_port => 12345,
:ssl => false,
:wsgi_process_display_name => 'nova-api',
:workers => 37,
}
end
it { is_expected.to_not contain_class('apache::mod::ssl') }
it { is_expected.to contain_class('nova::wsgi::apache_api').with(
:servername => 'dummy.host',
:api_port => 12345,
:path => '/',
:ssl => false,
:wsgi_process_display_name => 'nova-api',
:workers => 37,
:threads => facts[:os_workers],
:priority => '10',
)}
end
context 'when ::nova::api is missing in the composition layer' do
let :pre_condition do
"include nova"
end
it { is_expected.to raise_error Puppet::Error, /::nova::api class must be declared in composition layer./ }
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({
:os_workers => 8,
:fqdn => 'some.host.tld'
}))
end
let (:platform_params) do
case facts[:osfamily]
when 'Debian'
{
:httpd_service_name => 'apache2',
:httpd_ports_file => '/etc/apache2/ports.conf',
:wsgi_script_path => '/usr/lib/cgi-bin/nova',
:api_wsgi_script_source => '/usr/bin/nova-api-wsgi',
}
when 'RedHat'
{
:httpd_service_name => 'httpd',
:httpd_ports_file => '/etc/httpd/conf/ports.conf',
:wsgi_script_path => '/var/www/cgi-bin/nova',
:api_wsgi_script_source => '/usr/bin/nova-api-wsgi',
}
end
end
it_behaves_like 'apache serving nova with mod_wsgi'
end
end
end