From 2ffc7aedf4c5e9a87828c2edefd00620f932fe35 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Thu, 15 Jun 2023 01:50:13 +0900 Subject: [PATCH] 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 --- manifests/ovs.pp | 19 +++---------------- manifests/params.pp | 6 ------ spec/classes/vswitch_ovs_spec.rb | 10 +++------- 3 files changed, 6 insertions(+), 29 deletions(-) diff --git a/manifests/ovs.pp b/manifests/ovs.pp index 2243dad5..d1f394c1 100644 --- a/manifests/ovs.pp +++ b/manifests/ovs.pp @@ -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 diff --git a/manifests/params.pp b/manifests/params.pp index 58a7a12a..a8125208 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -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: { diff --git a/spec/classes/vswitch_ovs_spec.rb b/spec/classes/vswitch_ovs_spec.rb index ac863da1..af2e4fd7 100644 --- a/spec/classes/vswitch_ovs_spec.rb +++ b/spec/classes/vswitch_ovs_spec.rb @@ -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'