From aefe211e71ae5a5241144f9fad314d65284567e8 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sun, 12 Nov 2023 01:31:27 +0900 Subject: [PATCH] Replace unnecessary ensure_resource Some of the packages managed via ensure_resource are defined in only the single class so we don't need ensure_resource. Also titles of the package resources are updated so that users can make references to the resources with a static name. In addition, some resource notifications are redundant because the same notification is implemented using anchors. Change-Id: I0aeaca27d6a05c711a744a3ea95dda6fa7e2cbf3 --- manifests/services/bgpvpn.pp | 6 ++---- manifests/services/l2gw.pp | 10 +++++----- manifests/services/sfc.pp | 5 ++--- spec/classes/neutron_services_bgpvpn_spec.rb | 2 +- spec/classes/neutron_services_sfc_spec.rb | 2 +- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/manifests/services/bgpvpn.pp b/manifests/services/bgpvpn.pp index 766387a9d..c544b3c11 100644 --- a/manifests/services/bgpvpn.pp +++ b/manifests/services/bgpvpn.pp @@ -47,12 +47,11 @@ class neutron::services::bgpvpn ( include neutron::deps include neutron::params - #This package just include the service API - ensure_resource( 'package', $::neutron::params::bgpvpn_plugin_package, { + package { 'python-networking-bgpvpn': ensure => $package_ensure, name => $::neutron::params::bgpvpn_plugin_package, tag => ['openstack', 'neutron-package'], - }) + } if is_service_default($service_providers) { # NOTE(tkajinam): bgpvpn requires the additional 'default' value. @@ -70,7 +69,6 @@ class neutron::services::bgpvpn ( } if $sync_db { - Package<| title == $::neutron::params::bgpvpn_plugin_package |> ~> Exec['bgpvpn-db-sync'] exec { 'bgpvpn-db-sync': command => 'neutron-db-manage --config-file /etc/neutron/neutron.conf --subproject networking-bgpvpn upgrade head', path => '/usr/bin', diff --git a/manifests/services/l2gw.pp b/manifests/services/l2gw.pp index 7b6059097..dd9b4df13 100644 --- a/manifests/services/l2gw.pp +++ b/manifests/services/l2gw.pp @@ -56,11 +56,11 @@ class neutron::services::l2gw ( include neutron::deps include neutron::params - ensure_resource( 'package', 'python-networking-l2gw', { - 'ensure' => $package_ensure, - 'name' => $::neutron::params::l2gw_package, - 'tag' => ['openstack', 'neutron-package'], - }) + package { 'python-networking-l2gw': + ensure => $package_ensure, + name => $::neutron::params::l2gw_package, + tag => ['openstack', 'neutron-package'], + } resources { 'neutron_l2gw_service_config': purge => $purge_config, diff --git a/manifests/services/sfc.pp b/manifests/services/sfc.pp index b056698f7..260ab80e2 100644 --- a/manifests/services/sfc.pp +++ b/manifests/services/sfc.pp @@ -53,11 +53,11 @@ class neutron::services::sfc ( include neutron::deps include neutron::params - ensure_resource( 'package', $::neutron::params::sfc_package, { + package { 'python-networking-sfc': ensure => $package_ensure, name => $::neutron::params::sfc_package, tag => ['openstack', 'neutron-package'], - }) + } neutron_sfc_service_config { 'sfc/drivers': value => $sfc_driver; @@ -69,7 +69,6 @@ class neutron::services::sfc ( } if $sync_db { - Package<| title == $::neutron::params::sfc_package |> ~> Exec['sfc-db-sync'] exec { 'sfc-db-sync': command => 'neutron-db-manage --config-file /etc/neutron/neutron.conf --subproject networking-sfc upgrade head', path => '/usr/bin', diff --git a/spec/classes/neutron_services_bgpvpn_spec.rb b/spec/classes/neutron_services_bgpvpn_spec.rb index 347a683e1..dc44ffd33 100644 --- a/spec/classes/neutron_services_bgpvpn_spec.rb +++ b/spec/classes/neutron_services_bgpvpn_spec.rb @@ -21,7 +21,7 @@ describe 'neutron::services::bgpvpn' do shared_examples 'neutron bgpvpn service plugin' do context 'with default params' do it 'installs bgpvpn package' do - should contain_package(platform_params[:bgpvpn_package_name]).with( + should contain_package('python-networking-bgpvpn').with( :ensure => 'present', :name => platform_params[:bgpvpn_package_name], ) diff --git a/spec/classes/neutron_services_sfc_spec.rb b/spec/classes/neutron_services_sfc_spec.rb index e0054366b..65d2d74a9 100644 --- a/spec/classes/neutron_services_sfc_spec.rb +++ b/spec/classes/neutron_services_sfc_spec.rb @@ -20,7 +20,7 @@ describe 'neutron::services::sfc' do shared_examples 'neutron sfc service plugin' do context 'with default params' do it 'installs sfc package' do - should contain_package(platform_params[:sfc_package_name]).with( + should contain_package('python-networking-sfc').with( :ensure => 'present', :name => platform_params[:sfc_package_name], )