Replace remaining validate_legacy

... because the validate_legacy function is marked for deprecation in
v9.0.0 from puppetlabs-stdlib.

NOTE:
- validation about service_providers has been removed for now, because
  we haven't yet implemented appropriate validations for MultiStrOpt

- validation logic in neutron::ml2::arista::l3 has been removed and
  will be reconsidered when we implement more global validation about
  BooleanOpt.

Change-Id: I4ecfbff4ad40516692b7bed51d7b422548954f10
This commit is contained in:
Takashi Kajinami 2023-09-14 11:10:58 +09:00
parent ec7611a8bd
commit 9e11dd2f1d
4 changed files with 11 additions and 28 deletions

View File

@ -64,12 +64,14 @@ class neutron::plugins::ml2::arista::l3(
include neutron::deps
require neutron::plugins::ml2
if !is_service_default($mlag_config) {
validate_legacy(Boolean, 'validate_bool', $mlag_config)
if $mlag_config and is_service_default($secondary_l3_host) {
fail('Must set secondary_l3_host when mlag_config is true.')
}
}
# TODO(tkajinam): Reconsider how we implement this. We probably should allow
# more flexible values like 'on' supported by oslo.config.
# if !is_service_default($mlag_config) {
# validate_legacy(Boolean, 'validate_bool', $mlag_config)
# if $mlag_config and is_service_default($secondary_l3_host) {
# fail('Must set secondary_l3_host when mlag_config is true.')
# }
# }
neutron_plugin_ml2 {
'l3_arista/primary_l3_host' : value => $primary_l3_host;

View File

@ -282,12 +282,9 @@ class neutron::server (
include neutron::policy
if !is_service_default($dhcp_load_type) {
validate_legacy(Enum['networks', 'subnets', 'ports'], 'validate_re', $dhcp_load_type,
[['^networks$', '^subnets$', '^ports$']])
if ! ($dhcp_load_type in ['networks', 'subnets', 'ports'] ) {
fail('Unsupported dhcp_load_type. It should be one of networks, subnets and ports.')
}
if !is_service_default($service_providers) {
validate_legacy(Array, 'validate_array', $service_providers)
}
if $ensure_vpnaas_package {

View File

@ -56,10 +56,6 @@ class neutron::services::l2gw (
include neutron::deps
include neutron::params
if !is_service_default($service_providers) {
validate_legacy(Array, 'validate_array', $service_providers)
}
ensure_resource( 'package', 'python-networking-l2gw', {
'ensure' => $package_ensure,
'name' => $::neutron::params::l2gw_package,

View File

@ -61,18 +61,6 @@ describe 'neutron::plugins::ml2::arista::l3' do
should contain_neutron_plugin_ml2('l3_arista/conn_timeout').with_value(p[:conn_timeout])
should contain_neutron_plugin_ml2('l3_arista/use_vrf').with_value(p[:use_vrf])
end
context 'with mlag enabled but secondary l3 host missing' do
before :each do
params.merge!({
:mlag_config => true
})
end
it 'should fail' do
should raise_error(Puppet::Error, /Must set secondary_l3_host when mlag_config is true./)
end
end
end
on_supported_os({