Do not declare service resource when manage_service is false
Change-Id: I6e8a61b641f86b241b71b55a93abd967960e0b96
This commit is contained in:
parent
3748c1e06d
commit
b0656ac23b
@ -87,41 +87,41 @@ class gnocchi::api (
|
||||
tag => ['openstack', 'gnocchi-package'],
|
||||
}
|
||||
|
||||
if $sync_db {
|
||||
include gnocchi::db::sync
|
||||
}
|
||||
|
||||
if $manage_service {
|
||||
if $enabled {
|
||||
$service_ensure = 'running'
|
||||
} else {
|
||||
$service_ensure = 'stopped'
|
||||
}
|
||||
}
|
||||
|
||||
if $sync_db {
|
||||
include gnocchi::db::sync
|
||||
}
|
||||
if $service_name == $::gnocchi::params::api_service_name {
|
||||
service { 'gnocchi-api':
|
||||
ensure => $service_ensure,
|
||||
name => $::gnocchi::params::api_service_name,
|
||||
enable => $enabled,
|
||||
hasstatus => true,
|
||||
hasrestart => true,
|
||||
tag => ['gnocchi-service', 'gnocchi-db-sync-service'],
|
||||
}
|
||||
} elsif $service_name == 'httpd' {
|
||||
service { 'gnocchi-api':
|
||||
ensure => 'stopped',
|
||||
name => $::gnocchi::params::api_service_name,
|
||||
enable => false,
|
||||
tag => ['gnocchi-service', 'gnocchi-db-sync-service'],
|
||||
}
|
||||
Service <| title == 'httpd' |> { tag +> 'gnocchi-service' }
|
||||
|
||||
if $service_name == $::gnocchi::params::api_service_name {
|
||||
service { 'gnocchi-api':
|
||||
ensure => $service_ensure,
|
||||
name => $::gnocchi::params::api_service_name,
|
||||
enable => $enabled,
|
||||
hasstatus => true,
|
||||
hasrestart => true,
|
||||
tag => ['gnocchi-service', 'gnocchi-db-sync-service'],
|
||||
}
|
||||
} elsif $service_name == 'httpd' {
|
||||
service { 'gnocchi-api':
|
||||
ensure => 'stopped',
|
||||
name => $::gnocchi::params::api_service_name,
|
||||
enable => false,
|
||||
tag => ['gnocchi-service', 'gnocchi-db-sync-service'],
|
||||
}
|
||||
Service <| title == 'httpd' |> { tag +> 'gnocchi-service' }
|
||||
|
||||
# we need to make sure gnocchi-api/eventlet is stopped before trying to start apache
|
||||
Service['gnocchi-api'] -> Service[$service_name]
|
||||
} else {
|
||||
fail("Invalid service_name. Either gnocchi/openstack-gnocchi-api for running as a \
|
||||
# we need to make sure gnocchi-api/eventlet is stopped before trying to start apache
|
||||
Service['gnocchi-api'] -> Service[$service_name]
|
||||
} else {
|
||||
fail("Invalid service_name. Either gnocchi/openstack-gnocchi-api for running as a \
|
||||
standalone service, or httpd for being run by a httpd server")
|
||||
}
|
||||
}
|
||||
|
||||
gnocchi_config {
|
||||
|
@ -87,15 +87,14 @@ class gnocchi::metricd (
|
||||
} else {
|
||||
$service_ensure = 'stopped'
|
||||
}
|
||||
}
|
||||
|
||||
service { 'gnocchi-metricd':
|
||||
ensure => $service_ensure,
|
||||
name => $::gnocchi::params::metricd_service_name,
|
||||
enable => $enabled,
|
||||
hasstatus => true,
|
||||
hasrestart => true,
|
||||
tag => ['gnocchi-service', 'gnocchi-db-sync-service'],
|
||||
service { 'gnocchi-metricd':
|
||||
ensure => $service_ensure,
|
||||
name => $::gnocchi::params::metricd_service_name,
|
||||
enable => $enabled,
|
||||
hasstatus => true,
|
||||
hasrestart => true,
|
||||
tag => ['gnocchi-service', 'gnocchi-db-sync-service'],
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -48,15 +48,15 @@ class gnocchi::statsd (
|
||||
} else {
|
||||
$service_ensure = 'stopped'
|
||||
}
|
||||
}
|
||||
|
||||
service { 'gnocchi-statsd':
|
||||
ensure => $service_ensure,
|
||||
name => $::gnocchi::params::statsd_service_name,
|
||||
enable => $enabled,
|
||||
hasstatus => true,
|
||||
hasrestart => true,
|
||||
tag => ['gnocchi-service', 'gnocchi-db-sync-service'],
|
||||
service { 'gnocchi-statsd':
|
||||
ensure => $service_ensure,
|
||||
name => $::gnocchi::params::statsd_service_name,
|
||||
enable => $enabled,
|
||||
hasstatus => true,
|
||||
hasrestart => true,
|
||||
tag => ['gnocchi-service', 'gnocchi-db-sync-service'],
|
||||
}
|
||||
}
|
||||
|
||||
gnocchi_config {
|
||||
|
@ -75,7 +75,7 @@ describe 'gnocchi::api' do
|
||||
|
||||
it 'configures gnocchi-api service' do
|
||||
is_expected.to contain_service('gnocchi-api').with(
|
||||
:ensure => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped',
|
||||
:ensure => params[:enabled] ? 'running' : 'stopped',
|
||||
:name => platform_params[:api_service_name],
|
||||
:enable => params[:enabled],
|
||||
:hasstatus => true,
|
||||
@ -99,19 +99,12 @@ describe 'gnocchi::api' do
|
||||
context 'with disabled service managing' do
|
||||
before do
|
||||
params.merge!({
|
||||
:manage_service => false,
|
||||
:enabled => false })
|
||||
:manage_service => false
|
||||
})
|
||||
end
|
||||
|
||||
it 'configures gnocchi-api service' do
|
||||
is_expected.to contain_service('gnocchi-api').with(
|
||||
:ensure => nil,
|
||||
:name => platform_params[:api_service_name],
|
||||
:enable => false,
|
||||
:hasstatus => true,
|
||||
:hasrestart => true,
|
||||
:tag => ['gnocchi-service', 'gnocchi-db-sync-service'],
|
||||
)
|
||||
it 'does not configure gnocchi-api service' do
|
||||
is_expected.to_not contain_service('gnocchi-api')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -49,19 +49,12 @@ describe 'gnocchi::metricd' do
|
||||
context 'with disabled service managing' do
|
||||
before do
|
||||
params.merge!({
|
||||
:manage_service => false,
|
||||
:enabled => false })
|
||||
:manage_service => false
|
||||
})
|
||||
end
|
||||
|
||||
it 'configures gnocchi-metricd service' do
|
||||
is_expected.to contain_service('gnocchi-metricd').with(
|
||||
:ensure => nil,
|
||||
:name => platform_params[:metricd_service_name],
|
||||
:enable => false,
|
||||
:hasstatus => true,
|
||||
:hasrestart => true,
|
||||
:tag => ['gnocchi-service', 'gnocchi-db-sync-service'],
|
||||
)
|
||||
it 'does not configure gnocchi-metricd service' do
|
||||
is_expected.to_not contain_service('gnocchi-metricd')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -37,7 +37,7 @@ describe 'gnocchi::statsd' do
|
||||
|
||||
it 'configures gnocchi-statsd service' do
|
||||
is_expected.to contain_service('gnocchi-statsd').with(
|
||||
:ensure => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped',
|
||||
:ensure => params[:enabled] ? 'running' : 'stopped',
|
||||
:name => platform_params[:statsd_service_name],
|
||||
:enable => params[:enabled],
|
||||
:hasstatus => true,
|
||||
@ -51,19 +51,12 @@ describe 'gnocchi::statsd' do
|
||||
context 'with disabled service managing' do
|
||||
before do
|
||||
params.merge!({
|
||||
:manage_service => false,
|
||||
:enabled => false })
|
||||
:manage_service => false
|
||||
})
|
||||
end
|
||||
|
||||
it 'configures gnocchi-statsd service' do
|
||||
is_expected.to contain_service('gnocchi-statsd').with(
|
||||
:ensure => nil,
|
||||
:name => platform_params[:statsd_service_name],
|
||||
:enable => false,
|
||||
:hasstatus => true,
|
||||
:hasrestart => true,
|
||||
:tag => ['gnocchi-service', 'gnocchi-db-sync-service'],
|
||||
)
|
||||
it 'does not configure gnocchi-statsd service' do
|
||||
is_expected.to_not contain_service('gnocchi-statsd')
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user