Use undef instead of $::os_service_default

$::os_service_default is not used in puppet-vswitch. This change
deprecates usage of it to prepare replacing it by undef, which is
commonly used instead.

Change-Id: Ibfe94720e28f5ce46977b2db2afa82a6888c28cb
This commit is contained in:
Takashi Kajinami
2021-12-28 13:25:48 +09:00
parent 1fe71cf5e3
commit fb9a08d972
5 changed files with 50 additions and 9 deletions

View File

@@ -41,7 +41,7 @@
#
# [*vlan_limit*]
# (optional) Number of vlan layers allowed.
# Default to $::os_service_default
# Default to undef
#
# [*revalidator_cores*]
# (Optional) Number of cores to be used for OVS Revalidator threads.
@@ -71,7 +71,7 @@ class vswitch::dpdk (
$socket_mem = undef,
$enable_hw_offload = false,
$disable_emc = false,
$vlan_limit = $::os_service_default,
$vlan_limit = undef,
$revalidator_cores = undef,
$handler_cores = undef,
$vs_config = {},
@@ -83,6 +83,13 @@ class vswitch::dpdk (
validate_legacy(Hash, 'validate_hash', $vs_config)
kmod::load { 'vfio-pci': }
if is_service_default($vlan_limit) {
warning('Usage of $::os_service_default for vlan_limit is deprecated. Use undef instead')
$vlan_limit_real = undef
} else {
$vlan_limit_real = $vlan_limit
}
if $::osfamily != 'Redhat' {
fail( "${::osfamily} not yet supported for dpdk installation by puppet-vswitch")
}
@@ -134,7 +141,18 @@ class vswitch::dpdk (
}
}
if ! is_service_default($vlan_limit) {
if is_service_default($vlan_limit) {
warning('Usage of $::os_service_default for vlan_limit is deprecated. Use undef instead')
vs_config { 'other_config:vlan-limit':
ensure => absent,
wait => true,
}
} elsif $vlan_limit == undef {
vs_config { 'other_config:vlan-limit':
ensure => absent,
wait => true,
}
} else {
vs_config { 'other_config:vlan-limit':
value => "${vlan_limit}",
wait => true,

View File

@@ -31,7 +31,7 @@
#
# [*vlan_limit*]
# (optional) Number of vlan layers allowed.
# Default to $::os_service_default
# Default to undef
#
# [*vs_config*]
# (optional) allow configuration of arbitary vsiwtch configurations.
@@ -45,7 +45,7 @@ class vswitch::ovs(
$dkms_ensure = false,
$enable_hw_offload = false,
$disable_emc = false,
$vlan_limit = $::os_service_default,
$vlan_limit = undef,
$vs_config = {},
) {
@@ -104,7 +104,18 @@ class vswitch::ovs(
}
}
if ! is_service_default($vlan_limit) {
if is_service_default($vlan_limit) {
warning('Usage of $::os_service_default for vlan_limit is deprecated. Use undef instead')
vs_config { 'other_config:vlan-limit':
ensure => absent,
wait => true,
}
} elsif $vlan_limit == undef {
vs_config { 'other_config:vlan-limit':
ensure => absent,
wait => true,
}
} else {
vs_config { 'other_config:vlan-limit':
value => "${vlan_limit}",
wait => true,

View File

@@ -0,0 +1,8 @@
---
deprecations:
- |
Usage of ``$::os_service_default`` fact for the following two parameters
have been deprecated. Use ``undef`` instead.
- ``ovs::ovs::vlan_limit``
- ``ovs::dpdk::vlan_limit``

View File

@@ -48,7 +48,9 @@ describe 'vswitch::dpdk' do
)
is_expected.to_not contain_vs_config('other_config:hw-offload')
is_expected.to_not contain_vs_config('other_config:emc-insert-inv-prob')
is_expected.to_not contain_vs_config('other_config:vlan-limit')
is_expected.to contain_vs_config('other_config:vlan-limit').with(
:ensure => 'absent', :wait => true,
)
end
end

View File

@@ -30,8 +30,10 @@ describe 'vswitch::ovs' do
is_expected.to_not contain_vs_config('other_config:emc-insert-inv-prob')
end
it 'does not set vlan-limit option' do
is_expected.to_not contain_vs_config('other_config:vlan-limit')
it 'clears vlan-limit option' do
is_expected.to contain_vs_config('other_config:vlan-limit').with(
:ensure => 'absent', :wait => true,
)
end
it 'configures service' do