WSGI: use real service name in restart_keystone Exec
Before, when running the Exec which restart Keystone service, we used $service_name but this is wrong because service_name can be keystone, openstack-keystone or httpd. On Ubuntu/Debian, Apache service name is not httpd but apache2. So the service could never be restarted if we were 1/ running Ubuntu/Debian 2/ changing the default domain name. This patch looks up in puppetlabs-apache the real Apache service name when $service_name is httpd (if WSGI is enabled and eventlet disabled). That way, we are sure the service name that will be used will the right one. Also add some unit tests that validate this change. Change-Id: I85226d862b63e227867ed43bc35d7fefc9e424cd Closes-bug: #1479783
This commit is contained in:
parent
2fd7fd339d
commit
f654d3cd9b
@ -832,6 +832,7 @@ class keystone(
|
||||
}
|
||||
|
||||
if $service_name == $::keystone::params::service_name {
|
||||
$service_name_real = $::keystone::params::service_name
|
||||
if $validate_service {
|
||||
if $validate_auth_url {
|
||||
$v_auth_url = $validate_auth_url
|
||||
@ -864,6 +865,7 @@ class keystone(
|
||||
}
|
||||
}
|
||||
} elsif $service_name == 'httpd' {
|
||||
include ::apache::params
|
||||
class { '::keystone::service':
|
||||
ensure => 'stopped',
|
||||
service_name => $::keystone::params::service_name,
|
||||
@ -871,6 +873,7 @@ class keystone(
|
||||
provider => $service_provider,
|
||||
validate => false,
|
||||
}
|
||||
$service_name_real = $::apache::params::service_name
|
||||
} else {
|
||||
fail('Invalid service_name. Either keystone/openstack-keystone for running as a standalone service, or httpd for being run by a httpd server')
|
||||
}
|
||||
@ -976,7 +979,7 @@ class keystone(
|
||||
if $manage_service and $enabled {
|
||||
exec { 'restart_keystone':
|
||||
path => ['/usr/sbin', '/usr/bin', '/sbin', '/bin/'],
|
||||
command => "service ${service_name} restart",
|
||||
command => "service ${service_name_real} restart",
|
||||
refreshonly => true,
|
||||
}
|
||||
}
|
||||
|
@ -864,20 +864,37 @@ describe 'keystone' do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when configuring default domain' do
|
||||
shared_examples_for "when configuring default domain" do
|
||||
describe 'with default config' do
|
||||
let :params do
|
||||
default_params
|
||||
end
|
||||
it { is_expected.to_not contain_exec('restart_keystone') }
|
||||
end
|
||||
describe 'with default domain and service is managed and enabled' do
|
||||
describe 'with default domain and eventlet service is managed and enabled' do
|
||||
let :params do
|
||||
default_params.merge({
|
||||
'default_domain'=> 'test',
|
||||
})
|
||||
end
|
||||
it { is_expected.to contain_exec('restart_keystone') }
|
||||
it { is_expected.to contain_exec('restart_keystone').with(
|
||||
'command' => "service #{platform_parameters[:service_name]} restart",
|
||||
) }
|
||||
it { is_expected.to contain_anchor('default_domain_created') }
|
||||
end
|
||||
describe 'with default domain and wsgi service is managed and enabled' do
|
||||
let :pre_condition do
|
||||
'include ::apache'
|
||||
end
|
||||
let :params do
|
||||
default_params.merge({
|
||||
'default_domain'=> 'test',
|
||||
'service_name' => 'httpd',
|
||||
})
|
||||
end
|
||||
it { is_expected.to contain_exec('restart_keystone').with(
|
||||
'command' => "service #{platform_parameters[:httpd_service_name]} restart",
|
||||
) }
|
||||
it { is_expected.to contain_anchor('default_domain_created') }
|
||||
end
|
||||
describe 'with default domain and service is not managed' do
|
||||
@ -902,11 +919,13 @@ describe 'keystone' do
|
||||
|
||||
let :platform_parameters do
|
||||
{
|
||||
:service_name => 'openstack-keystone'
|
||||
:service_name => 'openstack-keystone',
|
||||
:httpd_service_name => 'httpd',
|
||||
}
|
||||
end
|
||||
|
||||
it_configures 'when using default class parameters for httpd'
|
||||
it_configures 'when configuring default domain'
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
@ -920,10 +939,12 @@ describe 'keystone' do
|
||||
|
||||
let :platform_parameters do
|
||||
{
|
||||
:service_name => 'keystone'
|
||||
:service_name => 'keystone',
|
||||
:httpd_service_name => 'apache2',
|
||||
}
|
||||
end
|
||||
|
||||
it_configures 'when using default class parameters for httpd'
|
||||
it_configures 'when configuring default domain'
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user