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: I491cc86eb105bc5484ed60c605183859b40696c2
This commit is contained in:
Takashi Kajinami 2023-03-16 13:27:04 +09:00
parent 8b8659e8ca
commit ec281aacc7
6 changed files with 21 additions and 0 deletions

View File

@ -92,6 +92,9 @@ class ironic::api (
include ironic::policy
include ironic::api::authtoken
validate_legacy(Boolean, 'validate_bool', $manage_service)
validate_legacy(Boolean, 'validate_bool', $enabled)
# Configure ironic.conf
ironic_config {
'api/host_ip': value => $host_ip;

View File

@ -286,6 +286,9 @@ class ironic::conductor (
include ironic::deps
include ironic::params
validate_legacy(Boolean, 'validate_bool', $enabled)
validate_legacy(Boolean, 'validate_bool', $manage_service)
# For backward compatibility
include ironic::glance

View File

@ -154,6 +154,9 @@ class ironic::drivers::pxe (
) inherits ironic::params {
include ironic::deps
validate_legacy(Boolean, 'validate_bool', $enable_ppc64le)
include ironic::pxe::common
$tftp_root_real = pick($::ironic::pxe::common::tftp_root, $tftp_root)
$ipxe_timeout_real = pick($::ironic::pxe::common::ipxe_timeout, $ipxe_timeout)

View File

@ -238,6 +238,12 @@ class ironic::inspector (
$uefi_ipxe_bootfile_name = $::ironic::params::uefi_ipxe_bootfile_name,
) inherits ironic::params {
validate_legacy(Boolean, 'validate_bool', $manage_service)
validate_legacy(Boolean, 'validate_bool', $enabled)
validate_legacy(Boolean, 'validate_bool', $dhcp_debug)
validate_legacy(Boolean, 'validate_bool', $dnsmasq_dhcp_sequential_ip)
validate_legacy(Boolean, 'validate_bool', $sync_db)
validate_legacy(Boolean, 'validate_bool', $enable_ppc64le)
validate_legacy(Array, 'validate_array', $dnsmasq_ip_subnets)
validate_legacy(Hash, 'validate_hash', $port_physnet_cidr_map)

View File

@ -103,6 +103,8 @@ class ironic::json_rpc (
include ironic::deps
validate_legacy(Boolean, 'validate_bool', $use_ssl)
if is_service_default($system_scope) {
$project_name_real = $project_name
$project_domain_name_real = $project_domain_name

View File

@ -113,6 +113,10 @@ class ironic::pxe (
include ironic::deps
include ironic::pxe::common
validate_legacy(Boolean, 'validate_bool', $manage_service)
validate_legacy(Boolean, 'validate_bool', $enabled)
validate_legacy(Boolean, 'validate_bool', $manage_http_server)
$tftp_root_real = pick($::ironic::pxe::common::tftp_root, $tftp_root)
$http_root_real = pick($::ironic::pxe::common::http_root, $http_root)
$http_port_real = pick($::ironic::pxe::common::http_port, $http_port)