Do not define service resource when service management is disabled

Change-Id: Ib43b45c7232ef5ccbb91949a7b6d1a1aa3da1d28
This commit is contained in:
Takashi Kajinami
2022-02-10 13:44:38 +09:00
parent c4c41a75cd
commit e9f6080596
3 changed files with 34 additions and 41 deletions

View File

@@ -73,17 +73,16 @@ 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':
@@ -107,6 +106,7 @@ class cloudkitty::api (
} else {
fail('Invalid service_name. Only httpd for being run by a httpd server')
}
}
cloudkitty_config {
'api/host_ip': value => $host_ip;

View File

@@ -87,7 +87,6 @@ class cloudkitty::processor (
} else {
$service_ensure = 'stopped'
}
}
service { 'cloudkitty-processor':
ensure => $service_ensure,
@@ -97,6 +96,7 @@ class cloudkitty::processor (
hasrestart => true,
tag => 'cloudkitty-service',
}
}
cloudkitty_config {
'collect/window': value => $window;

View File

@@ -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