wsgi/apache: add more WSGI params

For backward compatibility with puppet-keystone, we need to add more
parameters.

Change-Id: Iba3a15c4d90c2a5c284b91d6803d7478e5e95eeb
This commit is contained in:
Emilien Macchi
2014-12-30 18:01:03 -05:00
parent c6b739f6ad
commit 210980fa01
2 changed files with 50 additions and 34 deletions

View File

@@ -95,11 +95,23 @@
# (optional) The number of workers for the vhost. # (optional) The number of workers for the vhost.
# Defaults to '1' # Defaults to '1'
# #
# [*wsgi_script_path*] # [*wsgi_daemon_process*]
# (optional) The path of the WSGI script. # (optional) Name of the WSGI daemon process.
# Defaults to $name
#
# [*wsgi_daemon_group*]
# (optional) Name of the WSGI process group.
# Defaults to $name
#
# [*wsgi_script_dir*]
# (optional) The directory path of the WSGI script.
# Defaults to undef # Defaults to undef
# #
# [*wsgi_script_script*] # [*wsgi_script_file*]
# (optional) The file path of the WSGI script.
# Defaults to undef
#
# [*wsgi_script_source*]
# (optional) The source of the WSGI script. # (optional) The source of the WSGI script.
# Defaults to undef # Defaults to undef
# #
@@ -122,7 +134,10 @@ define openstacklib::wsgi::apache (
$threads = $::processorcount, $threads = $::processorcount,
$user = undef, $user = undef,
$workers = 1, $workers = 1,
$wsgi_script_path = undef, $wsgi_daemon_process = $name,
$wsgi_process_group = $name,
$wsgi_script_dir = undef,
$wsgi_script_file = undef,
$wsgi_script_source = undef, $wsgi_script_source = undef,
) { ) {
@@ -135,8 +150,8 @@ define openstacklib::wsgi::apache (
# Ensure there's no trailing '/' except if this is also the only character # Ensure there's no trailing '/' except if this is also the only character
$path_real = regsubst($path, '(^/.*)/$', '\1') $path_real = regsubst($path, '(^/.*)/$', '\1')
if !defined(File[$wsgi_script_path]) { if !defined(File[$wsgi_script_dir]) {
file { $wsgi_script_path: file { $wsgi_script_dir:
ensure => directory, ensure => directory,
owner => $user, owner => $user,
group => $group, group => $group,
@@ -146,12 +161,12 @@ define openstacklib::wsgi::apache (
file { $service_name: file { $service_name:
ensure => file, ensure => file,
path => "${wsgi_script_path}/${service_name}", path => "${wsgi_script_dir}/${wsgi_script_file}",
source => $wsgi_script_source, source => $wsgi_script_source,
owner => $user, owner => $user,
group => $group, group => $group,
mode => '0644', mode => '0644',
require => File[$wsgi_script_path], require => File[$wsgi_script_dir],
} }
$wsgi_daemon_process_options = { $wsgi_daemon_process_options = {
@@ -160,14 +175,14 @@ define openstacklib::wsgi::apache (
processes => $workers, processes => $workers,
threads => $threads, threads => $threads,
} }
$wsgi_script_aliases = hash([$path_real,$wsgi_script_path]) $wsgi_script_aliases = hash([$path_real,"${wsgi_script_dir}/${wsgi_script_file}"])
::apache::vhost { $service_name: ::apache::vhost { $service_name:
ensure => 'present', ensure => 'present',
servername => $servername, servername => $servername,
ip => $bind_host, ip => $bind_host,
port => $bind_port, port => $bind_port,
docroot => $wsgi_script_path, docroot => $wsgi_script_dir,
docroot_owner => $user, docroot_owner => $user,
docroot_group => $group, docroot_group => $group,
priority => $priority, priority => $priority,
@@ -179,9 +194,9 @@ define openstacklib::wsgi::apache (
ssl_crl_path => $ssl_crl_path, ssl_crl_path => $ssl_crl_path,
ssl_crl => $ssl_crl, ssl_crl => $ssl_crl,
ssl_certs_dir => $ssl_certs_dir, ssl_certs_dir => $ssl_certs_dir,
wsgi_daemon_process => $service_name, wsgi_daemon_process => $wsgi_daemon_process,
wsgi_daemon_process_options => $wsgi_daemon_process_options, wsgi_daemon_process_options => $wsgi_daemon_process_options,
wsgi_process_group => $service_name, wsgi_process_group => $wsgi_process_group,
wsgi_script_aliases => $wsgi_script_aliases, wsgi_script_aliases => $wsgi_script_aliases,
require => File[$service_name], require => File[$service_name],
} }

View File

@@ -35,7 +35,8 @@ describe 'openstacklib::wsgi::apache' do
:group => 'keystone', :group => 'keystone',
:ssl => true, :ssl => true,
:user => 'keystone', :user => 'keystone',
:wsgi_script_path => '/var/www/cgi-bin/keystone', :wsgi_script_dir => '/var/www/cgi-bin/keystone',
:wsgi_script_file => 'main',
:wsgi_script_source => '/usr/share/keystone/keystone.wsgi' :wsgi_script_source => '/usr/share/keystone/keystone.wsgi'
} }
end end
@@ -56,7 +57,7 @@ describe 'openstacklib::wsgi::apache' do
it { should contain_file('keystone_wsgi').with( it { should contain_file('keystone_wsgi').with(
'ensure' => 'file', 'ensure' => 'file',
'path' => '/var/www/cgi-bin/keystone/keystone_wsgi', 'path' => '/var/www/cgi-bin/keystone/main',
'source' => '/usr/share/keystone/keystone.wsgi', 'source' => '/usr/share/keystone/keystone.wsgi',
'owner' => 'keystone', 'owner' => 'keystone',
'group' => 'keystone', 'group' => 'keystone',
@@ -73,7 +74,7 @@ describe 'openstacklib::wsgi::apache' do
'ssl' => 'true', 'ssl' => 'true',
'wsgi_daemon_process' => 'keystone_wsgi', 'wsgi_daemon_process' => 'keystone_wsgi',
'wsgi_process_group' => 'keystone_wsgi', 'wsgi_process_group' => 'keystone_wsgi',
'wsgi_script_aliases' => { '/' => "/var/www/cgi-bin/keystone" }, 'wsgi_script_aliases' => { '/' => "/var/www/cgi-bin/keystone/main" },
'require' => 'File[keystone_wsgi]' 'require' => 'File[keystone_wsgi]'
)} )}
it { should contain_file("#{platform_parameters[:httpd_ports_file]}") } it { should contain_file("#{platform_parameters[:httpd_ports_file]}") }