Add a few more strict type validations

Some logics (especially ones in templates) require specific data types.
This adds a few more type validations to avoid users from passing
unexpected types of inputs.

Change-Id: I7f77203f3eb431e96fde1fdfae0f0c51b7a8aaed
This commit is contained in:
Takashi Kajinami 2023-06-20 11:26:23 +09:00
parent 658a12dda5
commit 53bc36b448
5 changed files with 111 additions and 110 deletions

View File

@ -26,8 +26,8 @@
# Defaults to undef
#
class horizon::dashboards::designate(
$policy_file = 'designate_policy.yaml',
$policies = undef,
String[1] $policy_file = 'designate_policy.yaml',
Optional[Hash] $policies = undef,
) {
include horizon::deps

View File

@ -39,10 +39,10 @@
#
class horizon::dashboards::heat(
$enable_user_pass = true,
$policy_file = 'heat_policy.yaml',
String[1] $policy_file = 'heat_policy.yaml',
$template_generator_api_timeout = 60,
$template_generator_api_parallel = 2,
$policies = undef,
Optional[Hash] $policies = undef,
) {
include horizon::deps

View File

@ -37,9 +37,9 @@
# Defaults to undef
#
class horizon::dashboards::manila(
$policy_file = 'manila_policy.yaml',
$manila_options = {},
$policies = undef,
String[1] $policy_file = 'manila_policy.yaml',
Hash $manila_options = {},
Optional[Hash] $policies = undef,
) {
include horizon::deps

View File

@ -26,8 +26,8 @@
# Defaults to undef
#
class horizon::dashboards::octavia(
$policy_file = 'octavia_policy.yaml',
$policies = undef,
String[1] $policy_file = 'octavia_policy.yaml',
Optional[Hash] $policies = undef,
) {
include horizon::deps

View File

@ -568,108 +568,109 @@
#
class horizon(
$secret_key,
$package_ensure = 'present',
$cache_backend = 'django.core.cache.backends.locmem.LocMemCache',
$cache_options = undef,
$cache_timeout = undef,
$cache_server_url = undef,
$cache_server_ip = undef,
$cache_server_port = '11211',
Boolean $cache_tls_enabled = false,
$cache_tls_cafile = undef,
$cache_tls_certfile = undef,
$cache_tls_keyfile = undef,
$cache_tls_allowed_ciphers = undef,
Boolean $manage_memcache_package = true,
$horizon_app_links = undef,
$keystone_url = 'http://127.0.0.1:5000',
$keystone_default_role = 'member',
$django_debug = 'False',
$site_branding = undef,
$openstack_endpoint_type = undef,
$secondary_endpoint_type = undef,
$openstack_keystone_endpoint_type = undef,
$available_regions = undef,
$api_result_limit = undef,
$api_result_page_size = undef,
$dropdown_max_items = undef,
$log_handlers = ['file'],
$log_level = 'INFO',
$django_log_level = undef,
$django_template_log_level = 'INFO',
$syslog_facility = 'local1',
$help_url = undef,
$bug_url = undef,
$local_settings_template = 'horizon/local_settings.py.erb',
Boolean $configure_apache = true,
$bind_address = undef,
$servername = $facts['networking']['fqdn'],
$server_aliases = $facts['networking']['fqdn'],
$allowed_hosts = $facts['networking']['fqdn'],
Boolean $listen_ssl = false,
$http_port = 80,
$https_port = 443,
Boolean $ssl_no_verify = false,
$openstack_ssl_cacert = '',
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',
Boolean $compress_offline = true,
$hypervisor_options = {},
$cinder_options = {},
$keystone_options = {},
$neutron_options = {},
$instance_options = {},
$use_simple_tenant_usage = undef,
$file_upload_temp_dir = '/tmp',
Optional[String] $policy_files_path = undef,
$policy_files = undef,
$redirect_type = 'permanent',
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,
Stdlib::Absolutepath $root_path = "${::horizon::params::static_path}/openstack-dashboard",
$access_log_format = undef,
$session_timeout = 1800,
$timezone = 'UTC',
Boolean $secure_cookies = false,
$django_session_engine = undef,
$vhost_extra_params = undef,
$available_themes = false,
$default_theme = false,
Enum['on', 'off'] $password_autocomplete = 'off',
$create_image_defaults = undef,
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,
Boolean $disallow_iframe_embed = true,
Boolean $websso_enabled = false,
$websso_initial_choice = undef,
$websso_choices = undef,
Boolean $websso_choices_hide_keystone = false,
$websso_idp_mapping = undef,
Boolean $websso_default_redirect = false,
$websso_default_redirect_protocol = undef,
$websso_default_redirect_region = undef,
$websso_default_redirect_logout = undef,
$password_validator = undef,
$password_validator_help = undef,
$customization_module = undef,
$horizon_upload_mode = undef,
$default_boot_source = undef,
$system_scope_services = undef,
$package_ensure = 'present',
$cache_backend = 'django.core.cache.backends.locmem.LocMemCache',
$cache_options = undef,
$cache_timeout = undef,
$cache_server_url = undef,
$cache_server_ip = undef,
$cache_server_port = '11211',
Boolean $cache_tls_enabled = false,
$cache_tls_cafile = undef,
$cache_tls_certfile = undef,
$cache_tls_keyfile = undef,
$cache_tls_allowed_ciphers = undef,
Boolean $manage_memcache_package = true,
$horizon_app_links = undef,
$keystone_url = 'http://127.0.0.1:5000',
$keystone_default_role = 'member',
$django_debug = 'False',
$site_branding = undef,
$openstack_endpoint_type = undef,
$secondary_endpoint_type = undef,
$openstack_keystone_endpoint_type = undef,
$available_regions = undef,
$api_result_limit = undef,
$api_result_page_size = undef,
$dropdown_max_items = undef,
Array[String[1]] $log_handlers = ['file'],
$log_level = 'INFO',
$django_log_level = undef,
$django_template_log_level = 'INFO',
$syslog_facility = 'local1',
$help_url = undef,
$bug_url = undef,
$local_settings_template = 'horizon/local_settings.py.erb',
Boolean $configure_apache = true,
$bind_address = undef,
$servername = $facts['networking']['fqdn'],
$server_aliases = $facts['networking']['fqdn'],
$allowed_hosts = $facts['networking']['fqdn'],
Boolean $listen_ssl = false,
$http_port = 80,
$https_port = 443,
Boolean $ssl_no_verify = false,
$openstack_ssl_cacert = '',
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',
Boolean $compress_offline = true,
# TODO(tkajinam) Consider adding more strict validation about key-value
Hash $hypervisor_options = {},
Hash $cinder_options = {},
Hash $keystone_options = {},
Hash $neutron_options = {},
Hash $instance_options = {},
$use_simple_tenant_usage = undef,
$file_upload_temp_dir = '/tmp',
Optional[String] $policy_files_path = undef,
Optional[Hash[String, String]] $policy_files = undef,
$redirect_type = 'permanent',
Hash $api_versions = {},
Boolean $keystone_multidomain_support = false,
$keystone_default_domain = undef,
$keystone_domain_choices = undef,
Hash[String, Hash[String, String]] $image_backend = {},
$overview_days_range = undef,
$root_url = $::horizon::params::root_url,
Stdlib::Absolutepath $root_path = "${::horizon::params::static_path}/openstack-dashboard",
$access_log_format = undef,
$session_timeout = 1800,
$timezone = 'UTC',
Boolean $secure_cookies = false,
$django_session_engine = undef,
$vhost_extra_params = undef,
$available_themes = false,
$default_theme = false,
Enum['on', 'off'] $password_autocomplete = 'off',
$create_image_defaults = undef,
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,
Boolean $disallow_iframe_embed = true,
Boolean $websso_enabled = false,
$websso_initial_choice = undef,
$websso_choices = undef,
Boolean $websso_choices_hide_keystone = false,
$websso_idp_mapping = undef,
Boolean $websso_default_redirect = false,
$websso_default_redirect_protocol = undef,
$websso_default_redirect_region = undef,
$websso_default_redirect_logout = undef,
$password_validator = undef,
$password_validator_help = undef,
$customization_module = undef,
$horizon_upload_mode = undef,
$default_boot_source = undef,
$system_scope_services = undef,
# DEPRECATED PARAMETERS
$images_panel = undef,
$images_panel = undef,
) inherits horizon::params {
include horizon::deps