Merge "Fix API service scheduling"

This commit is contained in:
Zuul 2020-04-17 13:22:46 +00:00 committed by Gerrit Code Review
commit edf3e94d76
3 changed files with 27 additions and 44 deletions

View File

@ -82,6 +82,10 @@ class cloudkitty::api (
enable => false,
tag => 'cloudkitty-service',
}
Service <| title == 'httpd' |> { tag +> 'cloudkitty-service' }
# we need to make sure cloudkitty-api/eventlet is stopped before trying to start apache
Service['cloudkitty-api'] -> Service[$service_name]
} else {
fail('Invalid service_name. Only httpd for being run by a httpd server')
}

View File

@ -91,9 +91,12 @@ class cloudkitty::keystone::auth (
include cloudkitty::deps
if $configure_user_role {
Keystone_user_role["${auth_name}@${tenant}"] ~> Anchor['cloudkitty::config::end']
Keystone_user_role["${auth_name}@${tenant}"] ~> Anchor['cloudkitty::service::end']
}
if $configure_endpoint {
Keystone_endpoint["${region}/${service_name}::${service_type}"] ~> Anchor['cloudkitty::service::end']
}
Keystone_endpoint["${region}/${service_name}::${service_type}"] ~> Anchor['cloudkitty::config::end']
keystone::resource::service_identity { 'cloudkitty':
configure_user => $configure_user,
@ -119,4 +122,3 @@ class cloudkitty::keystone::auth (
}
}

View File

@ -10,15 +10,17 @@ describe 'cloudkitty::api' do
:pecan_debug => false }
end
shared_examples_for 'cloudkitty-api' do
let :pre_condition do
"class { 'cloudkitty::keystone::authtoken':
password => 'a_big_secret',
}"
end
context 'config params' do
let :pre_condition do
"include cloudkitty::db
include apache
class { 'cloudkitty': }
class { 'cloudkitty::keystone::authtoken':
password => 'a_big_secret',
}"
end
shared_examples 'cloudkitty-api' do
context 'with required params' do
it { is_expected.to contain_class('cloudkitty') }
it { is_expected.to contain_class('cloudkitty::params') }
it { is_expected.to contain_class('cloudkitty::deps') }
@ -28,14 +30,13 @@ describe 'cloudkitty::api' do
it { is_expected.to contain_cloudkitty_config('api/port').with_value( params[:port] ) }
it { is_expected.to contain_cloudkitty_config('api/pecan_debug').with_value( params[:pecan_debug] ) }
end
it 'installs cloudkitty-api package' do
is_expected.to contain_package('cloudkitty-api').with(
:ensure => 'present',
:name => platform_params[:api_package_name],
:tag => ['openstack', 'cloudkitty-package'],
)
it 'installs cloudkitty-api package' do
is_expected.to contain_package('cloudkitty-api').with(
:ensure => 'present',
:name => platform_params[:api_package_name],
:tag => ['openstack', 'cloudkitty-package'],
)
end
end
context 'when running cloudkitty-api in wsgi' do
@ -43,15 +44,6 @@ describe 'cloudkitty::api' do
params.merge!({ :service_name => 'httpd' })
end
let :pre_condition do
"include apache
include cloudkitty::db
class { 'cloudkitty': }
class { 'cloudkitty::keystone::authtoken':
password => 'a_big_secret',
}"
end
it 'configures cloudkitty-api service with Apache' do
is_expected.to contain_service('cloudkitty-api').with(
:ensure => 'stopped',
@ -67,15 +59,6 @@ describe 'cloudkitty::api' do
params.merge!({ :service_name => 'foobar' })
end
let :pre_condition do
"include apache
include cloudkitty::db
class { 'cloudkitty': }
class { 'cloudkitty::keystone::authtoken':
password => 'a_big_secret',
}"
end
it_raises 'a Puppet::Error', /Invalid service_name/
end
@ -85,11 +68,6 @@ describe 'cloudkitty::api' do
:sync_db => false,
})
end
let :pre_condition do
"class { 'cloudkitty::keystone::authtoken':
password => 'a_big_secret',
}"
end
it 'configures cloudkitty-api service to not subscribe to the dbsync resource' do
is_expected.to contain_service('cloudkitty-api').that_subscribes_to(nil)
@ -98,7 +76,7 @@ describe 'cloudkitty::api' do
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
@ -119,5 +97,4 @@ describe 'cloudkitty::api' do
it_behaves_like 'cloudkitty-api'
end
end
end