Fix service keystone conflict when running in apache
service keystone is started after the package is installed. When running keystone inside apache, we must ensure service keystone is neither running nor start at boot. This fixes error of apache during start: 'Address already in use: make_sock: could not bind to address host:35357' also add test for redhat platform when httpd is in use. Change-Id: Ie761450ea05a0c92e595b12d1c7ced9481eb967c
This commit is contained in:
parent
501f1f44b1
commit
4f684b24db
@ -318,8 +318,8 @@
|
||||
# web service. For example, after calling class {'keystone'...}
|
||||
# use class { 'keystone::wsgi::apache'...} to make keystone be
|
||||
# a web app using apache mod_wsgi.
|
||||
# Defaults to 'keystone'
|
||||
# NOTE: validate_service only applies if the value is 'keystone'
|
||||
# Defaults to '$::keystone::params::service_name'
|
||||
# NOTE: validate_service only applies if the default value is used.
|
||||
#
|
||||
# [*paste_config*]
|
||||
# (optional) Name of the paste configuration file that defines the
|
||||
@ -434,7 +434,7 @@ class keystone(
|
||||
$validate_cacert = undef,
|
||||
$paste_config = $::keystone::params::paste_config,
|
||||
$service_provider = $::keystone::params::service_provider,
|
||||
$service_name = 'keystone',
|
||||
$service_name = $::keystone::params::service_name,
|
||||
$max_token_size = undef,
|
||||
$admin_workers = max($::processorcount, 2),
|
||||
$public_workers = max($::processorcount, 2),
|
||||
@ -761,7 +761,7 @@ class keystone(
|
||||
}
|
||||
}
|
||||
|
||||
if $service_name == 'keystone' {
|
||||
if $service_name == $::keystone::params::service_name {
|
||||
if $validate_service {
|
||||
if $validate_auth_url {
|
||||
$v_auth_url = $validate_auth_url
|
||||
@ -771,7 +771,7 @@ class keystone(
|
||||
|
||||
class { '::keystone::service':
|
||||
ensure => $service_ensure,
|
||||
service_name => $::keystone::params::service_name,
|
||||
service_name => $service_name,
|
||||
enable => $enabled,
|
||||
hasstatus => true,
|
||||
hasrestart => true,
|
||||
@ -785,7 +785,7 @@ class keystone(
|
||||
} else {
|
||||
class { '::keystone::service':
|
||||
ensure => $service_ensure,
|
||||
service_name => $::keystone::params::service_name,
|
||||
service_name => $service_name,
|
||||
enable => $enabled,
|
||||
hasstatus => true,
|
||||
hasrestart => true,
|
||||
@ -793,6 +793,16 @@ class keystone(
|
||||
validate => false,
|
||||
}
|
||||
}
|
||||
} elsif $service_name == 'httpd' {
|
||||
class { '::keystone::service':
|
||||
ensure => 'stopped',
|
||||
service_name => $::keystone::params::service_name,
|
||||
enable => false,
|
||||
provider => $service_provider,
|
||||
validate => false,
|
||||
}
|
||||
} else {
|
||||
fail('Invalid service_name. Either keystone/openstack-keystone for running as a standalone service, or httpd for being run by a httpd server')
|
||||
}
|
||||
|
||||
if $enabled {
|
||||
|
@ -54,6 +54,8 @@ describe 'keystone' do
|
||||
'rabbit_host' => 'localhost',
|
||||
'rabbit_password' => 'guest',
|
||||
'rabbit_userid' => 'guest',
|
||||
'admin_workers' => 20,
|
||||
'public_workers' => 20,
|
||||
}
|
||||
|
||||
override_params = {
|
||||
@ -90,8 +92,6 @@ describe 'keystone' do
|
||||
'rabbit_host' => '127.0.0.1',
|
||||
'rabbit_password' => 'openstack',
|
||||
'rabbit_userid' => 'admin',
|
||||
'admin_workers' => 20,
|
||||
'public_workers' => 20,
|
||||
}
|
||||
|
||||
httpd_params = {'service_name' => 'httpd'}.merge(default_params)
|
||||
@ -231,7 +231,7 @@ describe 'keystone' do
|
||||
end
|
||||
end
|
||||
|
||||
describe "when using default class parameters for httpd" do
|
||||
shared_examples_for "when using default class parameters for httpd" do
|
||||
let :params do
|
||||
httpd_params
|
||||
end
|
||||
@ -244,10 +244,22 @@ describe 'keystone' do
|
||||
|
||||
it do
|
||||
expect {
|
||||
is_expected.to contain_service('keystone')
|
||||
}.to raise_error(RSpec::Expectations::ExpectationNotMetError, /expected that the catalogue would contain Service\[keystone\]/)
|
||||
should contain_service(platform_parameters[:service_name]).with('ensure' => 'running')
|
||||
}.to raise_error(RSpec::Expectations::ExpectationNotMetError, /expected that the catalogue would contain Service\[#{platform_parameters[:service_name]}\]/)
|
||||
end
|
||||
|
||||
it { should contain_class('keystone::service').with(
|
||||
'ensure' => 'stopped',
|
||||
'service_name' => platform_parameters[:service_name],
|
||||
'enable' => false,
|
||||
'validate' => false
|
||||
)}
|
||||
end
|
||||
|
||||
describe 'when using invalid service name for keystone' do
|
||||
let (:params) { {'service_name' => 'foo'}.merge(default_params) }
|
||||
|
||||
it_raises 'a Puppet::Error', /Invalid service_name/
|
||||
end
|
||||
|
||||
describe 'with disabled service managing' do
|
||||
@ -788,4 +800,39 @@ describe 'keystone' do
|
||||
)}
|
||||
end
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
global_facts.merge({
|
||||
:osfamily => 'RedHat',
|
||||
:operatingsystemrelease => '7.0'
|
||||
})
|
||||
end
|
||||
|
||||
let :platform_parameters do
|
||||
{
|
||||
:service_name => 'openstack-keystone'
|
||||
}
|
||||
end
|
||||
|
||||
it_configures 'when using default class parameters for httpd'
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
global_facts.merge({
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian',
|
||||
:operatingsystemrelease => '7.0'
|
||||
})
|
||||
end
|
||||
|
||||
let :platform_parameters do
|
||||
{
|
||||
:service_name => 'keystone'
|
||||
}
|
||||
end
|
||||
|
||||
it_configures 'when using default class parameters for httpd'
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user