# HG changeset patch # User IBBoard # Date 1580040483 0 # Node ID 13825cc1ec57a352f4d40fe8e4af6733f5bba3e3 # Parent 165ad12ea8ca6e92608e7c6df48bf083e6c0acd1 Replace deprecated validation methods Puppet now supports data types diff -r 165ad12ea8ca -r 13825cc1ec57 modules/website/manifests/http.pp --- a/modules/website/manifests/http.pp Sun Jan 26 12:06:43 2020 +0000 +++ b/modules/website/manifests/http.pp Sun Jan 26 12:08:03 2020 +0000 @@ -6,18 +6,10 @@ $ensure = 'present', $custom_fragment = undef ) { - validate_re($ensure, '^(present|absent)$', - "${ensure} is not supported for ensure. - Allowed values are 'present' and 'absent'.") - if ! defined(Class['website']) { fail('You must include the website base class before using any website defined resources') } - validate_re($ensure, '^(present|absent)$', - "${ensure} is not supported for ensure. - Allowed values are 'present' and 'absent'.") - $shortname = domain_to_short_name($name) $logpart = $shortname diff -r 165ad12ea8ca -r 13825cc1ec57 modules/website/manifests/https.pp --- a/modules/website/manifests/https.pp Sun Jan 26 12:06:43 2020 +0000 +++ b/modules/website/manifests/https.pp Sun Jan 26 12:08:03 2020 +0000 @@ -26,10 +26,6 @@ fail('You must include the website base class before using any website defined resources') } - validate_re($ensure, '^(present|absent)$', - "${ensure} is not supported for ensure. - Allowed values are 'present' and 'absent'.") - $shortname = domain_to_short_name($name) $logpart = $shortname $shortdomain = domain_to_short_domain($name) diff -r 165ad12ea8ca -r 13825cc1ec57 modules/website/manifests/https/multitld.pp --- a/modules/website/manifests/https/multitld.pp Sun Jan 26 12:06:43 2020 +0000 +++ b/modules/website/manifests/https/multitld.pp Sun Jan 26 12:08:03 2020 +0000 @@ -1,29 +1,27 @@ define website::https::multitld ( - $docroot = undef, - $ip = $website::primary_ip, - $priority = undef, - $base = $name, - $main_tld = $website::tld, - $extra_tlds = $website::extra_tlds, - $ssl_ca_chain = undef, - $letsencrypt_name = undef, - $docroot_owner = undef, - $docroot_group = undef, - $custom_fragment = undef, - $force_no_index = undef, - $force_no_www = undef, - $csp = true, - $csp_override = undef, - $csp_report = true, - $csp_report_override = undef, + Optional[String] $docroot = undef, + String $ip = $website::primary_ip, + Optional[Integer] $priority = undef, + String $base = $name, + Pattern[/^[a-z]+(\.[a-z]+)?$/] $main_tld = $website::tld, + Array $extra_tlds = $website::extra_tlds, + Optional[String] $ssl_ca_chain = undef, + Optional[String] $letsencrypt_name = undef, + Optional[String] $docroot_owner = undef, + Optional[String] $docroot_group = undef, + Optional[String] $custom_fragment = undef, + Optional[Boolean] $force_no_index = undef, + Optional[Boolean] $force_no_www = undef, + Optional[Boolean] $csp = true, + Optional[Hash[String, String]] $csp_override = undef, + Boolean $csp_report = true, + Optional[Hash[String, String]] $csp_report_override = undef, ) { if ! defined(Class['website']) { fail('You must include the website base class before using any website defined resources') } - validate_array($extra_tlds) - validate_re($main_tld, '^[a-z]+(\.[a-z]+)?', 'TLD must be in the form "com" or "co.uk"') $alias = domain_to_short_domain($base) $base_aliases = prefix($extra_tlds, "${base}.") diff -r 165ad12ea8ca -r 13825cc1ec57 modules/website/manifests/https/redir.pp --- a/modules/website/manifests/https/redir.pp Sun Jan 26 12:06:43 2020 +0000 +++ b/modules/website/manifests/https/redir.pp Sun Jan 26 12:08:03 2020 +0000 @@ -15,10 +15,6 @@ $separate_log = false, ) { - validate_re($ensure, '^(present|absent)$', - "${ensure} is not supported for ensure. - Allowed values are 'present' and 'absent'.") - $shortname = domain_to_short_name($name) $logpart = $shortname $shortdomain = domain_to_short_domain($name) diff -r 165ad12ea8ca -r 13825cc1ec57 modules/website/manifests/init.pp --- a/modules/website/manifests/init.pp Sun Jan 26 12:06:43 2020 +0000 +++ b/modules/website/manifests/init.pp Sun Jan 26 12:08:03 2020 +0000 @@ -1,20 +1,14 @@ class website( - $base_dir, - $cert_dir = '/etc/pki/custom', - $primary_ip, - $secondary_ip, - $default_owner, - $default_group, - $default_tld = 'com', - $default_extra_tlds = [] + Pattern[/^(\/[^\/]+)*$/] $base_dir, + Pattern[/^(\/[^\/]+)*$/] $cert_dir = '/etc/pki/custom', + String $primary_ip, + String $secondary_ip, + String $default_owner, + String $default_group, + String $default_tld = 'com', + Array $default_extra_tlds = [] ){ - validate_re($base_dir, '^(/[^/]+)*$', - "${base_dir} is invalid - base_dir must be a directory without trailing slash.") - validate_re($cert_dir, '^(/[^/]+)*$', - "${cert_dir} is invalid - cert_dir must be a directory without trailing slash.") - validate_array($default_extra_tlds) - $basedir = $base_dir $certdir = $cert_dir $docroot_owner = $default_owner