Do not define service resource when service management is disabled
Change-Id: I64d3da1c9c6e379f410cf575c874c9d8d3153bb8
This commit is contained in:
parent
574fbdbe45
commit
58eb8a1733
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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')
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user