Merge "Do not define service resource when service management is disabled"

This commit is contained in:
Zuul 2022-02-14 19:35:45 +00:00 committed by Gerrit Code Review
commit 0897404400
8 changed files with 50 additions and 57 deletions

View File

@ -184,39 +184,37 @@ Use cinder::nova::region_name instead')
include cinder::db::sync
}
if $enabled {
if $manage_service {
if $manage_service {
if $enabled {
$ensure = 'running'
}
} else {
if $manage_service {
} else {
$ensure = 'stopped'
}
}
if $service_name == $::cinder::params::api_service {
service { 'cinder-api':
ensure => $ensure,
name => $::cinder::params::api_service,
enable => $enabled,
hasstatus => true,
tag => 'cinder-service',
}
if $service_name == $::cinder::params::api_service {
service { 'cinder-api':
ensure => $ensure,
name => $::cinder::params::api_service,
enable => $enabled,
hasstatus => true,
tag => 'cinder-service',
}
} elsif $service_name == 'httpd' {
service { 'cinder-api':
ensure => 'stopped',
name => $::cinder::params::api_service,
enable => false,
tag => ['cinder-service'],
}
Service <| title == 'httpd' |> { tag +> 'cinder-service' }
} elsif $service_name == 'httpd' {
service { 'cinder-api':
ensure => 'stopped',
name => $::cinder::params::api_service,
enable => false,
tag => ['cinder-service'],
}
Service <| title == 'httpd' |> { tag +> 'cinder-service' }
# we need to make sure cinder-api/eventlet is stopped before trying to start apache
Service['cinder-api'] -> Service[$service_name]
} else {
fail("Invalid service_name. Either cinder-api/openstack-cinder-api for \
# we need to make sure cinder-api/eventlet is stopped before trying to start apache
Service['cinder-api'] -> Service[$service_name]
} else {
fail("Invalid service_name. Either cinder-api/openstack-cinder-api for \
running as a standalone service, or httpd for being run by a httpd server")
}
}
cinder_config {

View File

@ -88,14 +88,14 @@ class cinder::backup (
} else {
$ensure = 'stopped'
}
}
service { 'cinder-backup':
ensure => $ensure,
name => $::cinder::params::backup_service,
enable => $enabled,
hasstatus => true,
tag => 'cinder-service',
service { 'cinder-backup':
ensure => $ensure,
name => $::cinder::params::backup_service,
enable => $enabled,
hasstatus => true,
tag => 'cinder-service',
}
}
cinder_config {

View File

@ -50,13 +50,13 @@ class cinder::scheduler (
} else {
$ensure = 'stopped'
}
}
service { 'cinder-scheduler':
ensure => $ensure,
name => $::cinder::params::scheduler_service,
enable => $enabled,
hasstatus => true,
tag => 'cinder-service',
service { 'cinder-scheduler':
ensure => $ensure,
name => $::cinder::params::scheduler_service,
enable => $enabled,
hasstatus => true,
tag => 'cinder-service',
}
}
}

View File

@ -92,14 +92,14 @@ class cinder::volume (
} else {
$ensure = 'stopped'
}
}
service { 'cinder-volume':
ensure => $ensure,
name => $::cinder::params::volume_service,
enable => $enabled,
hasstatus => true,
tag => 'cinder-service',
service { 'cinder-volume':
ensure => $ensure,
name => $::cinder::params::volume_service,
enable => $enabled,
hasstatus => true,
tag => 'cinder-service',
}
}
cinder_config {

View File

@ -101,7 +101,7 @@ describe 'cinder::api' do
req_params.merge({'manage_service' => false})
end
it 'should not change the state of the service' do
is_expected.to contain_service('cinder-api').without_ensure
is_expected.to_not contain_service('cinder-api')
end
it 'includes cinder::db::sync' do
is_expected.to contain_class('cinder::db::sync')

View File

@ -91,13 +91,8 @@ describe 'cinder::backup' do
before :each do
params.merge!(:manage_service => false)
end
it 'should not change the state of the service' do
is_expected.to contain_service('cinder-backup').with(
:ensure => nil,
:name => platform_params[:backup_service],
:hasstatus => true,
:tag => 'cinder-service',
)
it 'should not configure the service' do
is_expected.to_not contain_service('cinder-backup')
end
end

View File

@ -40,7 +40,7 @@ describe 'cinder::scheduler' do
}
end
it { is_expected.to contain_service('cinder-scheduler').without_ensure }
it { is_expected.to_not contain_service('cinder-scheduler') }
end
end

View File

@ -32,7 +32,7 @@ describe 'cinder::volume' do
}
end
it { is_expected.to contain_service('cinder-volume').without_ensure }
it { is_expected.to_not contain_service('cinder-volume') }
end
context 'with parameters overridden' do