Re-organize service definitions

None of supported operating systems have separate ovsdb-service, so
the logic to enable that separate service is unused and useless.

Also current definition of status and hasstatus are just redundant and
can be removed.

Change-Id: I361e55f144b4852f76c00b8dab26c4cec37b29c1
This commit is contained in:
Takashi Kajinami 2023-06-15 01:50:13 +09:00
parent 54106dc6da
commit 2ffc7aedf4
3 changed files with 6 additions and 29 deletions

View File

@ -91,22 +91,9 @@ class vswitch::ovs(
create_resources('vs_config', $vs_config)
service { 'openvswitch':
ensure => true,
enable => true,
name => $::vswitch::params::ovs_service_name,
status => $::vswitch::params::ovs_status,
hasstatus => $::vswitch::params::ovs_service_hasstatus
}
if $::vswitch::params::ovsdb_service_name {
service { 'ovsdb-server':
ensure => true,
enable => true,
name => $::vswitch::params::ovsdb_service_name,
status => $::vswitch::params::ovsdb_status,
}
Service['ovsdb-server'] ~> Service['openvswitch']
ensure => true,
enable => true,
name => $::vswitch::params::ovs_service_name,
}
# NOTE(tkajinam): This resource is defined to restart the openvswitch service

View File

@ -10,18 +10,12 @@ class vswitch::params {
# OVS and also DPDK (if enabled at runtime).
$ovs_dpdk_package_name = 'openvswitch'
$ovs_service_name = 'openvswitch'
$ovsdb_service_name = undef
$ovs_service_hasstatus = undef
$ovs_status = undef
$provider = 'ovs'
}
'Debian': {
$ovs_package_name = 'openvswitch-switch'
$ovs_dpdk_package_name = 'openvswitch-switch-dpdk'
$ovs_service_name = 'openvswitch-switch'
$ovsdb_service_name = undef
$ovs_service_hasstatus = true
$ovs_status = undef
$provider = 'ovs'
}
default: {

View File

@ -41,11 +41,9 @@ describe 'vswitch::ovs' do
it 'configures service' do
is_expected.to contain_service('openvswitch').with(
:ensure => true,
:enable => true,
:name => platform_params[:ovs_service_name],
:hasstatus => platform_params[:service_hasstatus],
:status => platform_params[:service_status],
:ensure => true,
:enable => true,
:name => platform_params[:ovs_service_name],
)
end
@ -117,14 +115,12 @@ describe 'vswitch::ovs' do
:ovs_package_name => 'openvswitch-switch',
:ovs_service_name => 'openvswitch-switch',
:provider => 'ovs',
:service_hasstatus => true,
}
elsif facts[:os]['name'] == 'Ubuntu'
{
:ovs_package_name => 'openvswitch-switch',
:ovs_service_name => 'openvswitch-switch',
:provider => 'ovs',
:service_hasstatus => true,
}
end
when 'RedHat'