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,7 +68,6 @@ class octavia::health_manager (
} else { } else {
$service_ensure = 'stopped' $service_ensure = 'stopped'
} }
}
service { 'octavia-health-manager': service { 'octavia-health-manager':
ensure => $service_ensure, ensure => $service_ensure,
@ -78,6 +77,7 @@ class octavia::health_manager (
hasrestart => true, hasrestart => true,
tag => ['octavia-service'], tag => ['octavia-service'],
} }
}
octavia_config { octavia_config {
'health_manager/heartbeat_key' : value => $heartbeat_key; 'health_manager/heartbeat_key' : value => $heartbeat_key;

View File

@ -77,7 +77,6 @@ class octavia::housekeeping (
} else { } else {
$service_ensure = 'stopped' $service_ensure = 'stopped'
} }
}
service { 'octavia-housekeeping': service { 'octavia-housekeeping':
ensure => $service_ensure, ensure => $service_ensure,
@ -87,6 +86,7 @@ class octavia::housekeeping (
hasrestart => true, hasrestart => true,
tag => ['octavia-service'], tag => ['octavia-service'],
} }
}
octavia_config { octavia_config {
'house_keeping/cleanup_interval' : value => $cleanup_interval; 'house_keeping/cleanup_interval' : value => $cleanup_interval;

View File

@ -86,9 +86,11 @@ class octavia::worker (
} }
$nova_flavor_defaults = merge($octavia_flavor_defaults, $nova_flavor_config) $nova_flavor_defaults = merge($octavia_flavor_defaults, $nova_flavor_config)
create_resources('nova_flavor', $octavia_flavor, $nova_flavor_defaults) create_resources('nova_flavor', $octavia_flavor, $nova_flavor_defaults)
if $manage_service {
Nova_flavor<| tag == 'octavia' |> ~> Service['octavia-worker'] Nova_flavor<| tag == 'octavia' |> ~> Service['octavia-worker']
} }
} }
}
package { 'octavia-worker': package { 'octavia-worker':
ensure => $package_ensure, ensure => $package_ensure,
@ -102,7 +104,6 @@ class octavia::worker (
} else { } else {
$service_ensure = 'stopped' $service_ensure = 'stopped'
} }
}
service { 'octavia-worker': service { 'octavia-worker':
ensure => $service_ensure, ensure => $service_ensure,
@ -112,6 +113,7 @@ class octavia::worker (
hasrestart => true, hasrestart => true,
tag => ['octavia-service'], tag => ['octavia-service'],
} }
}
if $manage_keygen and ! $::octavia::controller::enable_ssh_access { if $manage_keygen and ! $::octavia::controller::enable_ssh_access {
fail('SSH key management cannot be enabled when SSH key access is disabled') fail('SSH key management cannot be enabled when SSH key access is disabled')

View File

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

View File

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

View File

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