replace validate_legacy with proper data types

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

Depends-on: https://review.opendev.org/c/openstack/puppet-openstacklib/+/885996
Change-Id: I144468b4f5536a48702e457f2a5db879f3ca217a
This commit is contained in:
Takashi Kajinami 2023-06-20 10:52:41 +09:00
parent 7d927b9a02
commit 3021cd9daf
11 changed files with 39 additions and 74 deletions

View File

@ -57,12 +57,12 @@
# #
class heat::api ( class heat::api (
$package_ensure = 'present', $package_ensure = 'present',
$manage_service = true, Boolean $manage_service = true,
$enabled = true, Boolean $enabled = true,
$bind_host = $facts['os_service_default'], $bind_host = $facts['os_service_default'],
$bind_port = $facts['os_service_default'], $bind_port = $facts['os_service_default'],
$workers = $facts['os_service_default'], $workers = $facts['os_service_default'],
$use_ssl = false, Boolean $use_ssl = false,
$cert_file = $facts['os_service_default'], $cert_file = $facts['os_service_default'],
$key_file = $facts['os_service_default'], $key_file = $facts['os_service_default'],
$service_name = $::heat::params::api_service_name, $service_name = $::heat::params::api_service_name,
@ -73,10 +73,6 @@ class heat::api (
include heat::params include heat::params
include heat::policy 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 $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')

View File

@ -60,12 +60,12 @@
# #
class heat::api_cfn ( class heat::api_cfn (
$package_ensure = 'present', $package_ensure = 'present',
$manage_service = true, Boolean $manage_service = true,
$enabled = true, Boolean $enabled = true,
$bind_host = $facts['os_service_default'], $bind_host = $facts['os_service_default'],
$bind_port = $facts['os_service_default'], $bind_port = $facts['os_service_default'],
$workers = $facts['os_service_default'], $workers = $facts['os_service_default'],
$use_ssl = false, Boolean $use_ssl = false,
$cert_file = $facts['os_service_default'], $cert_file = $facts['os_service_default'],
$key_file = $facts['os_service_default'], $key_file = $facts['os_service_default'],
$service_name = $::heat::params::api_cfn_service_name, $service_name = $::heat::params::api_cfn_service_name,
@ -76,10 +76,6 @@ class heat::api_cfn (
include heat::params include heat::params
include heat::policy 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 $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')

View File

@ -24,15 +24,12 @@
# or Puppet catalog compilation will fail with duplicate resources. # or Puppet catalog compilation will fail with duplicate resources.
# #
class heat::config ( class heat::config (
$heat_config = {}, Hash $heat_config = {},
$heat_api_paste_ini = {}, Hash $heat_api_paste_ini = {},
) { ) {
include heat::deps include heat::deps
validate_legacy(Hash, 'validate_hash', $heat_config)
validate_legacy(Hash, 'validate_hash', $heat_api_paste_ini)
create_resources('heat_config', $heat_config) create_resources('heat_config', $heat_config)
create_resources('heat_api_paste_ini', $heat_api_paste_ini) create_resources('heat_api_paste_ini', $heat_api_paste_ini)
} }

View File

@ -57,11 +57,10 @@ class heat::db (
$database_pool_timeout = $facts['os_service_default'], $database_pool_timeout = $facts['os_service_default'],
$mysql_enable_ndb = $facts['os_service_default'], $mysql_enable_ndb = $facts['os_service_default'],
$database_db_max_retries = $facts['os_service_default'], $database_db_max_retries = $facts['os_service_default'],
$sync_db = true, Boolean $sync_db = true,
) { ) {
include heat::deps include heat::deps
validate_legacy(Boolean, 'validate_bool', $sync_db)
oslo::db { 'heat_config': oslo::db { 'heat_config':
connection => $database_connection, connection => $database_connection,

View File

@ -34,7 +34,7 @@
# Defaults to 'utf8_general_ci' # Defaults to 'utf8_general_ci'
# #
class heat::db::mysql( class heat::db::mysql(
$password, String[1] $password,
$dbname = 'heat', $dbname = 'heat',
$user = 'heat', $user = 'heat',
$host = '127.0.0.1', $host = '127.0.0.1',
@ -45,8 +45,6 @@ class heat::db::mysql(
include heat::deps include heat::deps
validate_legacy(String, 'validate_string', $password)
::openstacklib::db::mysql { 'heat': ::openstacklib::db::mysql { 'heat':
user => $user, user => $user,
password => $password, password => $password,

View File

@ -179,10 +179,10 @@
# Defaults to undef # Defaults to undef
# #
class heat::engine ( class heat::engine (
$auth_encryption_key, String $auth_encryption_key,
$package_ensure = 'present', $package_ensure = 'present',
$manage_service = true, Boolean $manage_service = true,
$enabled = true, Boolean $enabled = true,
$heat_stack_user_role = $facts['os_service_default'], $heat_stack_user_role = $facts['os_service_default'],
$heat_metadata_server_url = $facts['os_service_default'], $heat_metadata_server_url = $facts['os_service_default'],
$heat_waitcondition_server_url = $facts['os_service_default'], $heat_waitcondition_server_url = $facts['os_service_default'],
@ -218,9 +218,6 @@ class heat::engine (
include heat::deps include heat::deps
validate_legacy(Boolean, 'validate_bool', $manage_service)
validate_legacy(Boolean, 'validate_bool', $enabled)
# Validate Heat Engine AES key # Validate Heat Engine AES key
# must be either 16, 24, or 32 bytes long # must be either 16, 24, or 32 bytes long
# https://bugs.launchpad.net/heat/+bug/1415887 # https://bugs.launchpad.net/heat/+bug/1415887
@ -233,16 +230,12 @@ class heat::engine (
include heat include heat
include heat::params include heat::params
# plugin_dirs value follows these rules: if is_service_default($plugin_dirs) {
# - default is $facts['os_service_default'] so Puppet won't try to configure it.
# - if set, array validation will be done for not empty and then configure the parameter.
# - Otherwise, fallback to default.
if !is_service_default($plugin_dirs) and !empty($plugin_dirs) {
validate_legacy(Array, 'validate_array', $plugin_dirs)
$plugin_dirs_real = join($plugin_dirs, ',')
} else {
$plugin_dirs_real = $facts['os_service_default'] $plugin_dirs_real = $facts['os_service_default']
} elsif empty($plugin_dirs) {
$plugin_dirs_real = $facts['os_service_default']
} else {
$plugin_dirs_real = join(any2array($plugin_dirs), ',')
} }
package { 'heat-engine': package { 'heat-engine':

View File

@ -289,8 +289,10 @@ class heat(
$host = $facts['os_service_default'], $host = $facts['os_service_default'],
$flavor = $facts['os_service_default'], $flavor = $facts['os_service_default'],
$region_name = $facts['os_service_default'], $region_name = $facts['os_service_default'],
$enable_stack_adopt = $facts['os_service_default'], Variant[Openstacklib::ServiceDefault, Boolean] $enable_stack_adopt
$enable_stack_abandon = $facts['os_service_default'], = $facts['os_service_default'],
Variant[Openstacklib::ServiceDefault, Boolean] $enable_stack_abandon
= $facts['os_service_default'],
$max_template_size = $facts['os_service_default'], $max_template_size = $facts['os_service_default'],
$max_json_body_size = $facts['os_service_default'], $max_json_body_size = $facts['os_service_default'],
$notification_transport_url = $facts['os_service_default'], $notification_transport_url = $facts['os_service_default'],
@ -369,14 +371,6 @@ class heat(
} }
include heat::clients include heat::clients
if (!is_service_default($enable_stack_adopt)) {
validate_legacy(Boolean, 'validate_bool', $enable_stack_adopt)
}
if (!is_service_default($enable_stack_abandon)) {
validate_legacy(Boolean, 'validate_bool', $enable_stack_abandon)
}
heat_config { heat_config {
'DEFAULT/host': value => $host; 'DEFAULT/host': value => $host;
'DEFAULT/max_template_size': value => $max_template_size; 'DEFAULT/max_template_size': value => $max_template_size;

View File

@ -109,7 +109,7 @@
# } # }
# #
class heat::keystone::auth ( class heat::keystone::auth (
$password, String[1] $password,
$email = 'heat@localhost', $email = 'heat@localhost',
$auth_name = 'heat', $auth_name = 'heat',
$service_name = 'heat', $service_name = 'heat',
@ -135,8 +135,6 @@ class heat::keystone::auth (
include heat::deps include heat::deps
validate_legacy(String, 'validate_string', $password)
Keystone::Resource::Service_identity['heat'] -> Anchor['heat::service::end'] Keystone::Resource::Service_identity['heat'] -> Anchor['heat::service::end']
keystone::resource::service_identity { 'heat': keystone::resource::service_identity { 'heat':

View File

@ -83,7 +83,7 @@
# } # }
# #
class heat::keystone::auth_cfn ( class heat::keystone::auth_cfn (
$password = false, String[1] $password,
$email = 'heat-cfn@localhost', $email = 'heat-cfn@localhost',
$auth_name = 'heat-cfn', $auth_name = 'heat-cfn',
$service_name = 'heat-cfn', $service_name = 'heat-cfn',
@ -105,8 +105,6 @@ class heat::keystone::auth_cfn (
include heat::deps include heat::deps
validate_legacy(String, 'validate_string', $password)
Keystone::Resource::Service_identity['heat-cfn'] -> Anchor['heat::service::end'] Keystone::Resource::Service_identity['heat-cfn'] -> Anchor['heat::service::end']
keystone::resource::service_identity { 'heat-cfn': keystone::resource::service_identity { 'heat-cfn':

View File

@ -48,7 +48,7 @@
class heat::policy ( class heat::policy (
$enforce_scope = $facts['os_service_default'], $enforce_scope = $facts['os_service_default'],
$enforce_new_defaults = $facts['os_service_default'], $enforce_new_defaults = $facts['os_service_default'],
$policies = {}, Hash $policies = {},
$policy_path = '/etc/heat/policy.yaml', $policy_path = '/etc/heat/policy.yaml',
$policy_default_rule = $facts['os_service_default'], $policy_default_rule = $facts['os_service_default'],
$policy_dirs = $facts['os_service_default'], $policy_dirs = $facts['os_service_default'],
@ -58,8 +58,6 @@ class heat::policy (
include heat::deps include heat::deps
include heat::params include heat::params
validate_legacy(Hash, 'validate_hash', $policies)
$policy_parameters = { $policy_parameters = {
policies => $policies, policies => $policies,
policy_path => $policy_path, policy_path => $policy_path,

View File

@ -158,8 +158,6 @@ class heat::wsgi::apache_api_cfn (
$vhost_custom_fragment = undef, $vhost_custom_fragment = undef,
) { ) {
validate_legacy(Integer, 'validate_integer', $port)
heat::wsgi::apache { 'api_cfn': heat::wsgi::apache { 'api_cfn':
port => $port, port => $port,
servername => $servername, servername => $servername,