Do not define service resource when service management is disabled
Change-Id: Ib43b45c7232ef5ccbb91949a7b6d1a1aa3da1d28
This commit is contained in:
parent
c4c41a75cd
commit
e9f6080596
|
@ -73,39 +73,39 @@ class cloudkitty::api (
|
|||
tag => ['openstack', 'cloudkitty-package'],
|
||||
}
|
||||
|
||||
if $sync_db {
|
||||
include cloudkitty::db::sync
|
||||
}
|
||||
|
||||
if $manage_service {
|
||||
if $enabled {
|
||||
$service_ensure = 'running'
|
||||
} else {
|
||||
$service_ensure = 'stopped'
|
||||
}
|
||||
}
|
||||
|
||||
if $sync_db {
|
||||
include cloudkitty::db::sync
|
||||
}
|
||||
if $service_name == $::cloudkitty::params::api_service_name {
|
||||
service { 'cloudkitty-api':
|
||||
enable => $enabled,
|
||||
name => 'cloudkitty-api',
|
||||
hasstatus => true,
|
||||
hasrestart => true,
|
||||
tag => 'cloudkitty-service',
|
||||
}
|
||||
} elsif $service_name == 'httpd' {
|
||||
service { 'cloudkitty-api':
|
||||
ensure => 'stopped',
|
||||
name => $::cloudkitty::params::api_service_name,
|
||||
enable => false,
|
||||
tag => 'cloudkitty-service',
|
||||
}
|
||||
Service <| title == 'httpd' |> { tag +> 'cloudkitty-service' }
|
||||
|
||||
if $service_name == $::cloudkitty::params::api_service_name {
|
||||
service { 'cloudkitty-api':
|
||||
enable => $enabled,
|
||||
name => 'cloudkitty-api',
|
||||
hasstatus => true,
|
||||
hasrestart => true,
|
||||
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')
|
||||
}
|
||||
} elsif $service_name == 'httpd' {
|
||||
service { 'cloudkitty-api':
|
||||
ensure => 'stopped',
|
||||
name => $::cloudkitty::params::api_service_name,
|
||||
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')
|
||||
}
|
||||
|
||||
cloudkitty_config {
|
||||
|
|
|
@ -87,15 +87,15 @@ class cloudkitty::processor (
|
|||
} else {
|
||||
$service_ensure = 'stopped'
|
||||
}
|
||||
}
|
||||
|
||||
service { 'cloudkitty-processor':
|
||||
ensure => $service_ensure,
|
||||
name => $::cloudkitty::params::processor_service_name,
|
||||
enable => $enabled,
|
||||
hasstatus => true,
|
||||
hasrestart => true,
|
||||
tag => 'cloudkitty-service',
|
||||
service { 'cloudkitty-processor':
|
||||
ensure => $service_ensure,
|
||||
name => $::cloudkitty::params::processor_service_name,
|
||||
enable => $enabled,
|
||||
hasstatus => true,
|
||||
hasrestart => true,
|
||||
tag => 'cloudkitty-service',
|
||||
}
|
||||
}
|
||||
|
||||
cloudkitty_config {
|
||||
|
|
|
@ -76,15 +76,8 @@ describe 'cloudkitty::processor' do
|
|||
:manage_service => false }
|
||||
end
|
||||
|
||||
it 'configures cloudkitty-processor service' do
|
||||
is_expected.to contain_service('cloudkitty-processor').with(
|
||||
:ensure => nil,
|
||||
:name => platform_params[:processor_service_name],
|
||||
:enable => false,
|
||||
:hasstatus => true,
|
||||
:hasrestart => true,
|
||||
:tag => 'cloudkitty-service',
|
||||
)
|
||||
it 'does not configure cloudkitty-processor service' do
|
||||
is_expected.to_not contain_service('cloudkitty-processor')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue