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: Ia67f4aba2c3064f9b0ba93430b9c0f7a14800ced
This commit is contained in:
Takashi Kajinami 2023-03-16 13:21:52 +09:00
parent 9f11a15e3f
commit 5fe73417a2
4 changed files with 12 additions and 0 deletions

View File

@ -73,6 +73,10 @@ class heat::api (
include heat::params
include heat::policy
validate_legacy(Boolean, 'validate_bool', $manage_service)
validate_legacy(Boolean, 'validate_bool', $enabled)
validate_legacy(Boolean, 'validate_bool', $use_ssl)
if $use_ssl {
if is_service_default($cert_file) {
fail('The cert_file parameter is required when use_ssl is set to true')

View File

@ -76,6 +76,10 @@ class heat::api_cfn (
include heat::params
include heat::policy
validate_legacy(Boolean, 'validate_bool', $manage_service)
validate_legacy(Boolean, 'validate_bool', $enabled)
validate_legacy(Boolean, 'validate_bool', $use_ssl)
if $use_ssl {
if is_service_default($cert_file) {
fail('The cert_file parameter is required when use_ssl is set to true')

View File

@ -61,6 +61,7 @@ class heat::db (
) {
include heat::deps
validate_legacy(Boolean, 'validate_bool', $sync_db)
oslo::db { 'heat_config':
connection => $database_connection,

View File

@ -218,6 +218,9 @@ class heat::engine (
include heat::deps
validate_legacy(Boolean, 'validate_bool', $manage_service)
validate_legacy(Boolean, 'validate_bool', $enabled)
# Validate Heat Engine AES key
# must be either 16, 24, or 32 bytes long
# https://bugs.launchpad.net/heat/+bug/1415887