Add strict validation about boolean parameters
This ensures the parameters used by if-else logic accept only boolean values because non-boolean can result in unexpected behavior. Change-Id: I408c705545fce77c0ad6990d7040723378f0cf0f
This commit is contained in:
@@ -95,6 +95,9 @@ class neutron::agents::bagpipe (
|
|||||||
$local_address = $facts['networking']['ip'],
|
$local_address = $facts['networking']['ip'],
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $manage_service)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $enabled)
|
||||||
|
|
||||||
include neutron::deps
|
include neutron::deps
|
||||||
include neutron::params
|
include neutron::params
|
||||||
|
|
||||||
|
@@ -54,6 +54,9 @@ class neutron::agents::bgp_dragent(
|
|||||||
$purge_config = false,
|
$purge_config = false,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $manage_service)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $enabled)
|
||||||
|
|
||||||
include neutron::deps
|
include neutron::deps
|
||||||
include neutron::params
|
include neutron::params
|
||||||
|
|
||||||
|
@@ -158,9 +158,11 @@ class neutron::agents::dhcp (
|
|||||||
include neutron::deps
|
include neutron::deps
|
||||||
include neutron::params
|
include neutron::params
|
||||||
|
|
||||||
validate_legacy('Boolean', 'validate_bool', $enable_isolated_metadata)
|
validate_legacy(Boolean, 'validate_bool', $manage_service)
|
||||||
validate_legacy('Boolean', 'validate_bool', $enable_force_metadata)
|
validate_legacy(Boolean, 'validate_bool', $enabled)
|
||||||
validate_legacy('Boolean', 'validate_bool', $enable_metadata_network)
|
validate_legacy(Boolean, 'validate_bool', $enable_isolated_metadata)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $enable_force_metadata)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $enable_metadata_network)
|
||||||
|
|
||||||
if (! ($enable_isolated_metadata or $enable_force_metadata)) and $enable_metadata_network {
|
if (! ($enable_isolated_metadata or $enable_force_metadata)) and $enable_metadata_network {
|
||||||
fail('enable_metadata_network to true requires enable_isolated_metadata or enable_force_metadata also enabled.')
|
fail('enable_metadata_network to true requires enable_isolated_metadata or enable_force_metadata also enabled.')
|
||||||
|
@@ -86,6 +86,9 @@ class neutron::agents::l2gw (
|
|||||||
$purge_config = false,
|
$purge_config = false,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $manage_service)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $enabled)
|
||||||
|
|
||||||
include neutron::deps
|
include neutron::deps
|
||||||
include neutron::params
|
include neutron::params
|
||||||
|
|
||||||
|
@@ -150,6 +150,10 @@ class neutron::agents::l3 (
|
|||||||
$network_log_local_output_log_base = $facts['os_service_default'],
|
$network_log_local_output_log_base = $facts['os_service_default'],
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $manage_service)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $enabled)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $ha_enabled)
|
||||||
|
|
||||||
include neutron::deps
|
include neutron::deps
|
||||||
include neutron::params
|
include neutron::params
|
||||||
|
|
||||||
|
@@ -92,7 +92,10 @@ class neutron::agents::metadata (
|
|||||||
$report_interval = $facts['os_service_default'],
|
$report_interval = $facts['os_service_default'],
|
||||||
$rpc_response_max_timeout = $facts['os_service_default'],
|
$rpc_response_max_timeout = $facts['os_service_default'],
|
||||||
$purge_config = false,
|
$purge_config = false,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $manage_service)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $enabled)
|
||||||
|
|
||||||
include neutron::deps
|
include neutron::deps
|
||||||
include neutron::params
|
include neutron::params
|
||||||
|
@@ -79,6 +79,9 @@ class neutron::agents::metering (
|
|||||||
$purge_config = false,
|
$purge_config = false,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $manage_service)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $enabled)
|
||||||
|
|
||||||
include neutron::deps
|
include neutron::deps
|
||||||
include neutron::params
|
include neutron::params
|
||||||
|
|
||||||
|
@@ -93,6 +93,8 @@ class neutron::agents::ml2::linuxbridge (
|
|||||||
validate_legacy(Array, 'validate_array', $tunnel_types)
|
validate_legacy(Array, 'validate_array', $tunnel_types)
|
||||||
validate_legacy(Array, 'validate_array', $physical_interface_mappings)
|
validate_legacy(Array, 'validate_array', $physical_interface_mappings)
|
||||||
validate_legacy(Array, 'validate_array', $bridge_mappings)
|
validate_legacy(Array, 'validate_array', $bridge_mappings)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $manage_service)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $enabled)
|
||||||
|
|
||||||
include neutron::deps
|
include neutron::deps
|
||||||
include neutron::params
|
include neutron::params
|
||||||
|
@@ -41,6 +41,8 @@ class neutron::agents::ml2::macvtap (
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
validate_legacy(Array, 'validate_array', $physical_interface_mappings)
|
validate_legacy(Array, 'validate_array', $physical_interface_mappings)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $manage_service)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $enabled)
|
||||||
|
|
||||||
include neutron::deps
|
include neutron::deps
|
||||||
include neutron::params
|
include neutron::params
|
||||||
|
@@ -64,6 +64,10 @@ class neutron::agents::ml2::mlnx (
|
|||||||
$enable_multi_interface_driver_cache_maintenance = false,
|
$enable_multi_interface_driver_cache_maintenance = false,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $manage_service)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $enabled)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $manage_package)
|
||||||
|
|
||||||
include neutron::deps
|
include neutron::deps
|
||||||
include neutron::params
|
include neutron::params
|
||||||
|
|
||||||
|
@@ -125,6 +125,9 @@ class neutron::agents::ml2::networking_baremetal (
|
|||||||
$report_interval = $facts['os_service_default'],
|
$report_interval = $facts['os_service_default'],
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $manage_service)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $enabled)
|
||||||
|
|
||||||
include neutron::deps
|
include neutron::deps
|
||||||
include neutron::params
|
include neutron::params
|
||||||
|
|
||||||
|
@@ -314,6 +314,11 @@ class neutron::agents::ml2::ovs (
|
|||||||
$network_log_local_output_log_base = $facts['os_service_default'],
|
$network_log_local_output_log_base = $facts['os_service_default'],
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $manage_service)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $enabled)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $manage_vswitch)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $enable_dpdk)
|
||||||
|
|
||||||
include neutron::deps
|
include neutron::deps
|
||||||
include neutron::params
|
include neutron::params
|
||||||
|
|
||||||
|
@@ -115,6 +115,9 @@ class neutron::agents::ml2::sriov (
|
|||||||
$resource_provider_inventory_defaults = {},
|
$resource_provider_inventory_defaults = {},
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $manage_service)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $enabled)
|
||||||
|
|
||||||
include neutron::deps
|
include neutron::deps
|
||||||
include neutron::params
|
include neutron::params
|
||||||
|
|
||||||
|
@@ -140,7 +140,10 @@ class neutron::agents::ovn_metadata (
|
|||||||
$root_helper_daemon = $facts['os_service_default'],
|
$root_helper_daemon = $facts['os_service_default'],
|
||||||
$state_path = '/var/lib/neutron',
|
$state_path = '/var/lib/neutron',
|
||||||
$purge_config = false,
|
$purge_config = false,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $manage_service)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $enabled)
|
||||||
|
|
||||||
include neutron::deps
|
include neutron::deps
|
||||||
include neutron::params
|
include neutron::params
|
||||||
|
@@ -5,10 +5,6 @@
|
|||||||
#
|
#
|
||||||
# === Parameters:
|
# === Parameters:
|
||||||
#
|
#
|
||||||
# [*enabled*]
|
|
||||||
# (required) Whether or not to enable the neutron service
|
|
||||||
# true/false
|
|
||||||
#
|
|
||||||
# [*package_ensure*]
|
# [*package_ensure*]
|
||||||
# (optional) The state of the package
|
# (optional) The state of the package
|
||||||
# Defaults to 'present'
|
# Defaults to 'present'
|
||||||
@@ -309,8 +305,12 @@
|
|||||||
# (optional) Allow plugins that support it to create VLAN transparent networks
|
# (optional) Allow plugins that support it to create VLAN transparent networks
|
||||||
# Defaults to $facts['os_service_default']
|
# Defaults to $facts['os_service_default']
|
||||||
#
|
#
|
||||||
|
# DEPRECATED PARAMETERS
|
||||||
|
#
|
||||||
|
# [*enabled*]
|
||||||
|
# (required) Whether or not to enable the neutron service
|
||||||
|
#
|
||||||
class neutron (
|
class neutron (
|
||||||
$enabled = true,
|
|
||||||
$package_ensure = 'present',
|
$package_ensure = 'present',
|
||||||
$bind_host = $facts['os_service_default'],
|
$bind_host = $facts['os_service_default'],
|
||||||
$bind_port = $facts['os_service_default'],
|
$bind_port = $facts['os_service_default'],
|
||||||
@@ -375,11 +375,17 @@ class neutron (
|
|||||||
$notification_transport_url = $facts['os_service_default'],
|
$notification_transport_url = $facts['os_service_default'],
|
||||||
$max_allowed_address_pair = $facts['os_service_default'],
|
$max_allowed_address_pair = $facts['os_service_default'],
|
||||||
$vlan_transparent = $facts['os_service_default'],
|
$vlan_transparent = $facts['os_service_default'],
|
||||||
|
# DEPRECATED PARAMETERS
|
||||||
|
$enabled = undef,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
include neutron::deps
|
include neutron::deps
|
||||||
include neutron::params
|
include neutron::params
|
||||||
|
|
||||||
|
if $enabled != undef {
|
||||||
|
warning('The neutron::enabled parameter has been deprecated and has no effect')
|
||||||
|
}
|
||||||
|
|
||||||
if ! is_service_default($use_ssl) and ($use_ssl) {
|
if ! is_service_default($use_ssl) and ($use_ssl) {
|
||||||
if is_service_default($cert_file) {
|
if is_service_default($cert_file) {
|
||||||
fail('The cert_file parameter is required when use_ssl is set to true')
|
fail('The cert_file parameter is required when use_ssl is set to true')
|
||||||
|
@@ -114,6 +114,11 @@ class neutron::plugins::ovs::opendaylight (
|
|||||||
$enable_ipv6 = false,
|
$enable_ipv6 = false,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $enable_tls)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $enable_hw_offload)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $enable_dpdk)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $enable_ipv6)
|
||||||
|
|
||||||
include neutron::deps
|
include neutron::deps
|
||||||
|
|
||||||
# Handle the case where ODL controller is also on this host
|
# Handle the case where ODL controller is also on this host
|
||||||
|
@@ -277,6 +277,12 @@ class neutron::server (
|
|||||||
$igmp_snooping_enable = $facts['os_service_default'],
|
$igmp_snooping_enable = $facts['os_service_default'],
|
||||||
) inherits neutron::params {
|
) inherits neutron::params {
|
||||||
|
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $enabled)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $manage_service)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $sync_db)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $ensure_vpnaas_package)
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $ensure_dr_package)
|
||||||
|
|
||||||
include neutron::deps
|
include neutron::deps
|
||||||
include neutron::db
|
include neutron::db
|
||||||
include neutron::policy
|
include neutron::policy
|
||||||
|
@@ -44,6 +44,8 @@ class neutron::services::bgpvpn (
|
|||||||
$purge_config = false,
|
$purge_config = false,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $sync_db)
|
||||||
|
|
||||||
include neutron::deps
|
include neutron::deps
|
||||||
include neutron::params
|
include neutron::params
|
||||||
|
|
||||||
|
@@ -53,6 +53,8 @@ class neutron::services::l2gw (
|
|||||||
$purge_config = false,
|
$purge_config = false,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $sync_db)
|
||||||
|
|
||||||
include neutron::deps
|
include neutron::deps
|
||||||
include neutron::params
|
include neutron::params
|
||||||
|
|
||||||
|
@@ -50,6 +50,8 @@ class neutron::services::sfc (
|
|||||||
$purge_config = false,
|
$purge_config = false,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
validate_legacy(Boolean, 'validate_bool', $sync_db)
|
||||||
|
|
||||||
include neutron::deps
|
include neutron::deps
|
||||||
include neutron::params
|
include neutron::params
|
||||||
|
|
||||||
@@ -60,8 +62,8 @@ class neutron::services::sfc (
|
|||||||
})
|
})
|
||||||
|
|
||||||
neutron_sfc_service_config {
|
neutron_sfc_service_config {
|
||||||
'sfc/drivers': value => $sfc_driver;
|
'sfc/drivers': value => $sfc_driver;
|
||||||
'flowclassifier/drivers': value => $fc_driver;
|
'flowclassifier/drivers': value => $fc_driver;
|
||||||
}
|
}
|
||||||
|
|
||||||
resources { 'neutron_sfc_service_config':
|
resources { 'neutron_sfc_service_config':
|
||||||
|
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
deprecations:
|
||||||
|
- |
|
||||||
|
The `neutron::enabled`` parameter has been deprecated. This parameter has
|
||||||
|
been unused and has had no effect.
|
Reference in New Issue
Block a user