Do not declare service resources when manage_service is false

This change ensures that service resources are not declared when
manage_service is false, to fix rspec-puppet 2.7.1 support.

Change-Id: I86e05c5182842b73d413ddc95f797c1da5fd0ac2
This commit is contained in:
Takashi Kajinami 2021-05-04 17:55:32 +09:00
parent 6fba0ace08
commit a7b46e1ef6
6 changed files with 33 additions and 52 deletions

View File

@ -68,15 +68,15 @@ class octavia::health_manager (
} else {
$service_ensure = 'stopped'
}
}
service { 'octavia-health-manager':
ensure => $service_ensure,
name => $::octavia::params::health_manager_service_name,
enable => $enabled,
hasstatus => true,
hasrestart => true,
tag => ['octavia-service'],
service { 'octavia-health-manager':
ensure => $service_ensure,
name => $::octavia::params::health_manager_service_name,
enable => $enabled,
hasstatus => true,
hasrestart => true,
tag => ['octavia-service'],
}
}
octavia_config {

View File

@ -77,15 +77,15 @@ class octavia::housekeeping (
} else {
$service_ensure = 'stopped'
}
}
service { 'octavia-housekeeping':
ensure => $service_ensure,
name => $::octavia::params::housekeeping_service_name,
enable => $enabled,
hasstatus => true,
hasrestart => true,
tag => ['octavia-service'],
service { 'octavia-housekeeping':
ensure => $service_ensure,
name => $::octavia::params::housekeeping_service_name,
enable => $enabled,
hasstatus => true,
hasrestart => true,
tag => ['octavia-service'],
}
}
octavia_config {

View File

@ -86,7 +86,9 @@ class octavia::worker (
}
$nova_flavor_defaults = merge($octavia_flavor_defaults, $nova_flavor_config)
create_resources('nova_flavor', $octavia_flavor, $nova_flavor_defaults)
Nova_flavor<| tag == 'octavia' |> ~> Service['octavia-worker']
if $manage_service {
Nova_flavor<| tag == 'octavia' |> ~> Service['octavia-worker']
}
}
}
@ -102,15 +104,15 @@ class octavia::worker (
} else {
$service_ensure = 'stopped'
}
}
service { 'octavia-worker':
ensure => $service_ensure,
name => $::octavia::params::worker_service_name,
enable => $enabled,
hasstatus => true,
hasrestart => true,
tag => ['octavia-service'],
service { 'octavia-worker':
ensure => $service_ensure,
name => $::octavia::params::worker_service_name,
enable => $enabled,
hasstatus => true,
hasrestart => true,
tag => ['octavia-service'],
}
}
if $manage_keygen and ! $::octavia::controller::enable_ssh_access {

View File

@ -71,15 +71,8 @@ describe 'octavia::health_manager' do
:enabled => false })
end
it 'configures octavia-health-manager service' do
is_expected.to contain_service('octavia-health-manager').with(
:ensure => nil,
:name => platform_params[:health_manager_service_name],
:enable => false,
:hasstatus => true,
:hasrestart => true,
:tag => ['octavia-service'],
)
it 'does not configure octavia-health-manager service' do
is_expected.to_not contain_service('octavia-health-manager')
end
end

View File

@ -77,15 +77,8 @@ describe 'octavia::housekeeping' do
:enabled => false })
end
it 'configures octavia-housekeeping service' do
is_expected.to contain_service('octavia-housekeeping').with(
:ensure => nil,
:name => platform_params[:housekeeping_service_name],
:enable => false,
:hasstatus => true,
:hasrestart => true,
:tag => ['octavia-service'],
)
it 'does not configure octavia-housekeeping service' do
is_expected.to_not contain_service('octavia-housekeeping')
end
end

View File

@ -116,15 +116,8 @@ describe 'octavia::worker' do
:enabled => false })
end
it 'configures octavia-worker service' do
is_expected.to contain_service('octavia-worker').with(
:ensure => nil,
:name => platform_params[:worker_service_name],
:enable => false,
:hasstatus => true,
:hasrestart => true,
:tag => ['octavia-service'],
)
it 'does not configure octavia-worker service' do
is_expected.to_not contain_service('octavia-worker')
end
end