replace validate_legacy with proper data types

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

Change-Id: I25ceb3215a4a198e7a8545eeec6f2eeeafbd81c2
This commit is contained in:
Takashi Kajinami 2023-06-20 11:05:12 +09:00
parent 1559bd8320
commit 658a12dda5
3 changed files with 114 additions and 140 deletions

View File

@ -575,12 +575,12 @@ class horizon(
$cache_server_url = undef,
$cache_server_ip = undef,
$cache_server_port = '11211',
$cache_tls_enabled = false,
Boolean $cache_tls_enabled = false,
$cache_tls_cafile = undef,
$cache_tls_certfile = undef,
$cache_tls_keyfile = undef,
$cache_tls_allowed_ciphers = undef,
$manage_memcache_package = true,
Boolean $manage_memcache_package = true,
$horizon_app_links = undef,
$keystone_url = 'http://127.0.0.1:5000',
$keystone_default_role = 'member',
@ -601,24 +601,24 @@ class horizon(
$help_url = undef,
$bug_url = undef,
$local_settings_template = 'horizon/local_settings.py.erb',
$configure_apache = true,
Boolean $configure_apache = true,
$bind_address = undef,
$servername = $facts['networking']['fqdn'],
$server_aliases = $facts['networking']['fqdn'],
$allowed_hosts = $facts['networking']['fqdn'],
$listen_ssl = false,
Boolean $listen_ssl = false,
$http_port = 80,
$https_port = 443,
$ssl_no_verify = false,
Boolean $ssl_no_verify = false,
$openstack_ssl_cacert = '',
$ssl_redirect = true,
Boolean $ssl_redirect = true,
$ssl_cert = undef,
$ssl_key = undef,
$ssl_ca = undef,
$ssl_verify_client = undef,
$wsgi_processes = $facts['os_workers'],
$wsgi_threads = '1',
$compress_offline = true,
Boolean $compress_offline = true,
$hypervisor_options = {},
$cinder_options = {},
$keystone_options = {},
@ -626,39 +626,39 @@ class horizon(
$instance_options = {},
$use_simple_tenant_usage = undef,
$file_upload_temp_dir = '/tmp',
$policy_files_path = undef,
Optional[String] $policy_files_path = undef,
$policy_files = undef,
$redirect_type = 'permanent',
$api_versions = {},
$keystone_multidomain_support = false,
Hash $api_versions = {},
Boolean $keystone_multidomain_support = false,
$keystone_default_domain = undef,
$keystone_domain_choices = undef,
$image_backend = {},
$overview_days_range = undef,
$root_url = $::horizon::params::root_url,
$root_path = "${::horizon::params::static_path}/openstack-dashboard",
Stdlib::Absolutepath $root_path = "${::horizon::params::static_path}/openstack-dashboard",
$access_log_format = undef,
$session_timeout = 1800,
$timezone = 'UTC',
$secure_cookies = false,
Boolean $secure_cookies = false,
$django_session_engine = undef,
$vhost_extra_params = undef,
$available_themes = false,
$default_theme = false,
$password_autocomplete = 'off',
Enum['on', 'off'] $password_autocomplete = 'off',
$create_image_defaults = undef,
$password_retrieve = false,
$disable_password_reveal = false,
$enforce_password_check = false,
$enable_secure_proxy_ssl_header = false,
Boolean $password_retrieve = false,
Boolean $disable_password_reveal = false,
Boolean $enforce_password_check = false,
Boolean $enable_secure_proxy_ssl_header = false,
$secure_proxy_addr_header = undef,
$disallow_iframe_embed = true,
$websso_enabled = false,
Boolean $disallow_iframe_embed = true,
Boolean $websso_enabled = false,
$websso_initial_choice = undef,
$websso_choices = undef,
$websso_choices_hide_keystone = false,
Boolean $websso_choices_hide_keystone = false,
$websso_idp_mapping = undef,
$websso_default_redirect = false,
Boolean $websso_default_redirect = false,
$websso_default_redirect_protocol = undef,
$websso_default_redirect_region = undef,
$websso_default_redirect_logout = undef,
@ -674,25 +674,6 @@ class horizon(
include horizon::deps
# Validate boolean parameters to avoid unexpected if-statement result
validate_legacy(Boolean, 'validate_bool', $cache_tls_enabled)
validate_legacy(Boolean, 'validate_bool', $manage_memcache_package)
validate_legacy(Boolean, 'validate_bool', $configure_apache)
validate_legacy(Boolean, 'validate_bool', $listen_ssl)
validate_legacy(Boolean, 'validate_bool', $ssl_no_verify)
validate_legacy(Boolean, 'validate_bool', $ssl_redirect)
validate_legacy(Boolean, 'validate_bool', $compress_offline)
validate_legacy(Boolean, 'validate_bool', $keystone_multidomain_support)
validate_legacy(Boolean, 'validate_bool', $secure_cookies)
validate_legacy(Boolean, 'validate_bool', $password_retrieve)
validate_legacy(Boolean, 'validate_bool', $disable_password_reveal)
validate_legacy(Boolean, 'validate_bool', $enforce_password_check)
validate_legacy(Boolean, 'validate_bool', $enable_secure_proxy_ssl_header)
validate_legacy(Boolean, 'validate_bool', $disallow_iframe_embed)
validate_legacy(Boolean, 'validate_bool', $websso_enabled)
validate_legacy(Boolean, 'validate_bool', $websso_choices_hide_keystone)
validate_legacy(Boolean, 'validate_bool', $websso_default_redirect)
if $images_panel {
warning('The images_panel parameter has been deprecated and has no effect.')
}
@ -771,16 +752,11 @@ class horizon(
$instance_options_real = merge($instance_defaults,$instance_options)
if $policy_files_path != undef {
validate_legacy(String, 'validate_string', $policy_files_path)
$policy_files_path_real = $policy_files_path
} else {
$policy_files_path_real = $::horizon::params::policy_dir
}
validate_legacy(Hash, 'validate_hash', $api_versions)
validate_legacy(Enum['on', 'off'], 'validate_re', $password_autocomplete, [['^on$', '^off$']])
validate_legacy(Stdlib::Absolutepath, 'validate_absolute_path', $root_path)
if $manage_memcache_package {
if $cache_backend =~ /\.MemcachedCache$/ {
ensure_packages('python-memcache', {

View File

@ -43,11 +43,11 @@ class horizon::policy(
$file_format = 'yaml',
$purge_config = false,
# service specific parameters
$cinder_policies = {},
$glance_policies = {},
$keystone_policies = {},
$neutron_policies = {},
$nova_policies = {},
Hash $cinder_policies = {},
Hash $glance_policies = {},
Hash $keystone_policies = {},
Hash $neutron_policies = {},
Hash $nova_policies = {},
) {
include horizon::deps

View File

@ -25,8 +25,8 @@
# Defaults to false.
#
define horizon::policy::base(
$policy_file = $name,
$policies = {},
String[1] $policy_file = $name,
Hash $policies = {},
$file_mode = '0640',
$file_format = 'yaml',
$purge_config = false,
@ -34,8 +34,6 @@ define horizon::policy::base(
include horizon::deps
include horizon::params
validate_legacy(String, 'validate_string', $policy_file)
if !defined(Class[horizon]){
fail('The horizon class should be included in advance')
}