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
This commit is contained in:
Takashi Kajinami 2023-11-12 01:31:27 +09:00
parent c69ceb7faf
commit aefe211e71
5 changed files with 11 additions and 14 deletions

View File

@ -47,12 +47,11 @@ class neutron::services::bgpvpn (
include neutron::deps include neutron::deps
include neutron::params include neutron::params
#This package just include the service API package { 'python-networking-bgpvpn':
ensure_resource( 'package', $::neutron::params::bgpvpn_plugin_package, {
ensure => $package_ensure, ensure => $package_ensure,
name => $::neutron::params::bgpvpn_plugin_package, name => $::neutron::params::bgpvpn_plugin_package,
tag => ['openstack', 'neutron-package'], tag => ['openstack', 'neutron-package'],
}) }
if is_service_default($service_providers) { if is_service_default($service_providers) {
# NOTE(tkajinam): bgpvpn requires the additional 'default' value. # NOTE(tkajinam): bgpvpn requires the additional 'default' value.
@ -70,7 +69,6 @@ class neutron::services::bgpvpn (
} }
if $sync_db { if $sync_db {
Package<| title == $::neutron::params::bgpvpn_plugin_package |> ~> Exec['bgpvpn-db-sync']
exec { 'bgpvpn-db-sync': exec { 'bgpvpn-db-sync':
command => 'neutron-db-manage --config-file /etc/neutron/neutron.conf --subproject networking-bgpvpn upgrade head', command => 'neutron-db-manage --config-file /etc/neutron/neutron.conf --subproject networking-bgpvpn upgrade head',
path => '/usr/bin', path => '/usr/bin',

View File

@ -56,11 +56,11 @@ class neutron::services::l2gw (
include neutron::deps include neutron::deps
include neutron::params include neutron::params
ensure_resource( 'package', 'python-networking-l2gw', { package { 'python-networking-l2gw':
'ensure' => $package_ensure, ensure => $package_ensure,
'name' => $::neutron::params::l2gw_package, name => $::neutron::params::l2gw_package,
'tag' => ['openstack', 'neutron-package'], tag => ['openstack', 'neutron-package'],
}) }
resources { 'neutron_l2gw_service_config': resources { 'neutron_l2gw_service_config':
purge => $purge_config, purge => $purge_config,

View File

@ -53,11 +53,11 @@ class neutron::services::sfc (
include neutron::deps include neutron::deps
include neutron::params include neutron::params
ensure_resource( 'package', $::neutron::params::sfc_package, { package { 'python-networking-sfc':
ensure => $package_ensure, ensure => $package_ensure,
name => $::neutron::params::sfc_package, name => $::neutron::params::sfc_package,
tag => ['openstack', 'neutron-package'], tag => ['openstack', 'neutron-package'],
}) }
neutron_sfc_service_config { neutron_sfc_service_config {
'sfc/drivers': value => $sfc_driver; 'sfc/drivers': value => $sfc_driver;
@ -69,7 +69,6 @@ class neutron::services::sfc (
} }
if $sync_db { if $sync_db {
Package<| title == $::neutron::params::sfc_package |> ~> Exec['sfc-db-sync']
exec { 'sfc-db-sync': exec { 'sfc-db-sync':
command => 'neutron-db-manage --config-file /etc/neutron/neutron.conf --subproject networking-sfc upgrade head', command => 'neutron-db-manage --config-file /etc/neutron/neutron.conf --subproject networking-sfc upgrade head',
path => '/usr/bin', path => '/usr/bin',

View File

@ -21,7 +21,7 @@ describe 'neutron::services::bgpvpn' do
shared_examples 'neutron bgpvpn service plugin' do shared_examples 'neutron bgpvpn service plugin' do
context 'with default params' do context 'with default params' do
it 'installs bgpvpn package' do it 'installs bgpvpn package' do
should contain_package(platform_params[:bgpvpn_package_name]).with( should contain_package('python-networking-bgpvpn').with(
:ensure => 'present', :ensure => 'present',
:name => platform_params[:bgpvpn_package_name], :name => platform_params[:bgpvpn_package_name],
) )

View File

@ -20,7 +20,7 @@ describe 'neutron::services::sfc' do
shared_examples 'neutron sfc service plugin' do shared_examples 'neutron sfc service plugin' do
context 'with default params' do context 'with default params' do
it 'installs sfc package' do it 'installs sfc package' do
should contain_package(platform_params[:sfc_package_name]).with( should contain_package('python-networking-sfc').with(
:ensure => 'present', :ensure => 'present',
:name => platform_params[:sfc_package_name], :name => platform_params[:sfc_package_name],
) )