Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stricter parameter types #1413

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
195 changes: 97 additions & 98 deletions manifests/init.pp

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions manifests/resource/geo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@
# '192.168.0.0/16': 'intra'

define nginx::resource::geo (
Hash $networks,
Optional[String] $default = undef,
Enum['present', 'absent'] $ensure = 'present',
Boolean $ranges = false,
Optional[String] $address = undef,
Optional[String] $delete = undef,
Optional[Array] $proxies = undef,
Optional[Boolean] $proxy_recursive = undef
Hash[Stdlib::IP::Address,String[1]] $networks,
Optional[String[1]] $default = undef,
Enum['present', 'absent'] $ensure = 'present',
Boolean $ranges = false,
Optional[String[1]] $address = undef,
Optional[Stdlib::IP::Address] $delete = undef,
Optional[Array[Stdlib::IP::Address]] $proxies = undef,
Boolean $proxy_recursive = false
) {
if ! defined(Class['nginx']) {
fail('You must include the nginx base class before using any defined resources')
Expand Down
90 changes: 45 additions & 45 deletions manifests/resource/location.pp
Original file line number Diff line number Diff line change
Expand Up @@ -187,76 +187,76 @@
Boolean $internal = false,
String $location = $name,
Variant[String[1],Array[String[1],1]] $server = undef,
Optional[String] $www_root = undef,
Optional[String] $autoindex = undef,
Optional[String[1]] $www_root = undef,
Optional[Nginx::Toggle] $autoindex = undef,
Optional[Enum['on', 'off']] $autoindex_exact_size = undef,
Optional[Enum['html', 'xml', 'json', 'jsonp']] $autoindex_format = undef,
Optional[Enum['on', 'off']] $autoindex_localtime = undef,
Array $index_files = [
Array[String[1]] $index_files = [
'index.html',
'index.htm',
'index.php',
],
Optional[String] $proxy = undef,
Optional[String] $proxy_redirect = $nginx::proxy_redirect,
String $proxy_read_timeout = $nginx::proxy_read_timeout,
String $proxy_connect_timeout = $nginx::proxy_connect_timeout,
String $proxy_send_timeout = $nginx::proxy_send_timeout,
Array $proxy_set_header = $nginx::proxy_set_header,
Array $proxy_hide_header = $nginx::proxy_hide_header,
Array $proxy_pass_header = $nginx::proxy_pass_header,
Array $proxy_ignore_header = $nginx::proxy_ignore_header,
Optional[String] $proxy_next_upstream = undef,
Optional[String] $fastcgi = undef,
Optional[String] $fastcgi_index = undef,
Optional[Hash] $fastcgi_param = undef,
String $fastcgi_params = "${nginx::conf_dir}/fastcgi.conf",
Optional[String] $fastcgi_script = undef,
Optional[String] $fastcgi_split_path = undef,
Optional[Stdlib::Httpurl] $proxy = undef,
Optional[String[1]] $proxy_redirect = $nginx::proxy_redirect,
Nginx::Time $proxy_read_timeout = $nginx::proxy_read_timeout,
Nginx::Time $proxy_connect_timeout = $nginx::proxy_connect_timeout,
Nginx::Time $proxy_send_timeout = $nginx::proxy_send_timeout,
Array[String[1]] $proxy_set_header = $nginx::proxy_set_header,
Array[String[1]] $proxy_hide_header = $nginx::proxy_hide_header,
Array[String[1]] $proxy_pass_header = $nginx::proxy_pass_header,
Array[String[1]] $proxy_ignore_header = $nginx::proxy_ignore_header,
Optional[String[1]] $proxy_next_upstream = undef,
Optional[String[1]] $fastcgi = undef,
Optional[String[1]] $fastcgi_index = undef,
Optional[Hash[String[1],String[1]]] $fastcgi_param = undef,
String[1] $fastcgi_params = "${nginx::conf_dir}/fastcgi.conf",
Optional[String[1]] $fastcgi_script = undef,
Optional[String[1]] $fastcgi_split_path = undef,
Optional[String] $uwsgi = undef,
Optional[Hash] $uwsgi_param = undef,
String $uwsgi_params = "${nginx::config::conf_dir}/uwsgi_params",
Optional[String] $uwsgi_read_timeout = undef,
String[1] $uwsgi_params = "${nginx::config::conf_dir}/uwsgi_params",
Optional[Nginx::Time] $uwsgi_read_timeout = undef,
Boolean $ssl = false,
Boolean $ssl_only = false,
Optional[String] $location_alias = undef,
Optional[String[1]] $location_alias = undef,
Optional[String[1]] $limit_zone = undef,
Optional[Enum['any', 'all']] $location_satisfy = undef,
Optional[Array] $location_allow = undef,
Optional[Array] $location_deny = undef,
Optional[Boolean] $stub_status = undef,
Optional[Variant[String, Array]] $raw_prepend = undef,
Optional[Variant[String, Array]] $raw_append = undef,
Optional[Hash] $location_custom_cfg = undef,
Optional[Hash] $location_cfg_prepend = undef,
Optional[Hash] $location_cfg_append = undef,
Optional[Hash] $location_custom_cfg_prepend = undef,
Optional[Hash] $location_custom_cfg_append = undef,
Optional[Array] $include = undef,
Optional[Array] $try_files = undef,
Optional[Array[String]] $location_allow = undef,
Optional[Array[String]] $location_deny = undef,
Boolean $stub_status = false,
Optional[Variant[String, Array[String]]] $raw_prepend = undef,
Optional[Variant[String, Array[String]]] $raw_append = undef,
Optional[Nginx::Directives] $location_custom_cfg = undef,
Optional[Nginx::Directives] $location_cfg_prepend = undef,
Optional[Nginx::Directives] $location_cfg_append = undef,
Optional[Nginx::Directives] $location_custom_cfg_prepend = undef,
Optional[Nginx::Directives] $location_custom_cfg_append = undef,
Optional[Array[String]] $include = undef,
Optional[Array[String]] $try_files = undef,
Optional[String] $proxy_cache = undef,
Optional[String] $proxy_cache_key = undef,
Optional[String] $proxy_cache_use_stale = undef,
Optional[Enum['on', 'off']] $proxy_cache_lock = undef,
Optional[Nginx::Toggle] $proxy_cache_lock = undef,
Optional[Variant[Array, String]] $proxy_cache_valid = undef,
Optional[Variant[Array, String]] $proxy_cache_bypass = undef,
Optional[String] $proxy_method = undef,
Optional[String] $proxy_http_version = undef,
Optional[String] $proxy_set_body = undef,
Optional[Enum['on', 'off']] $proxy_buffering = undef,
Optional[Enum['on', 'off']] $proxy_request_buffering = undef,
Optional[Enum['1.0','1.1']] $proxy_http_version = undef,
Optional[String[1]] $proxy_set_body = undef,
Optional[Nginx::Toggle] $proxy_buffering = undef,
Optional[Nginx::Toggle] $proxy_request_buffering = undef,
Optional[Nginx::Size] $proxy_max_temp_file_size = undef,
Optional[Nginx::Size] $proxy_busy_buffers_size = undef,
Optional[Enum['on', 'off']] $absolute_redirect = undef,
Optional[String] $auth_basic = undef,
Optional[String] $auth_basic_user_file = undef,
Optional[String] $auth_request = undef,
Array $rewrite_rules = [],
Optional[String[1]] $auth_basic = undef,
Optional[String[1]] $auth_basic_user_file = undef,
Optional[String[1]] $auth_request = undef,
Array[String[3]] $rewrite_rules = [],
Integer[401,599] $priority = 500,
Boolean $mp4 = false,
Boolean $flv = false,
Optional[String] $expires = undef,
Hash $add_header = {},
Optional[String[1]] $expires = undef,
Nginx::Headers $add_header = {},
Optional[Enum['on', 'off', 'always']] $gzip_static = undef,
) {
if ! defined(Class['nginx']) {
Expand Down
86 changes: 43 additions & 43 deletions manifests/resource/mailhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -76,49 +76,49 @@
#
define nginx::resource::mailhost (
Stdlib::Port $listen_port,
Enum['absent', 'present'] $ensure = 'present',
Variant[Array[String], String] $listen_ip = '*',
Optional[String] $listen_options = undef,
Boolean $ipv6_enable = false,
Variant[Array[String], String] $ipv6_listen_ip = '::',
Stdlib::Port $ipv6_listen_port = 80,
String $ipv6_listen_options = 'default ipv6only=on',
Boolean $ssl = false,
Optional[String] $ssl_cert = undef,
String $ssl_ciphers = $nginx::ssl_ciphers,
Optional[String] $ssl_client_cert = undef,
Optional[String] $ssl_crl = undef,
Optional[String] $ssl_dhparam = $nginx::ssl_dhparam,
Optional[String] $ssl_ecdh_curve = undef,
Optional[String] $ssl_key = undef,
Optional[String] $ssl_password_file = undef,
Optional[Stdlib::Port] $ssl_port = undef,
Enum['on', 'off'] $ssl_prefer_server_ciphers = $nginx::ssl_prefer_server_ciphers,
String $ssl_protocols = $nginx::ssl_protocols,
Optional[String] $ssl_session_cache = undef,
Optional[String] $ssl_session_ticket_key = undef,
Optional[String] $ssl_session_tickets = undef,
String $ssl_session_timeout = '5m',
Optional[String] $ssl_trusted_cert = undef,
Optional[Integer] $ssl_verify_depth = undef,
Enum['on', 'off', 'only'] $starttls = 'off',
$protocol = undef,
Optional[String] $auth_http = undef,
Optional[String] $auth_http_header = undef,
String $xclient = 'on',
Optional[String] $imap_auth = undef,
Optional[Array] $imap_capabilities = undef,
Optional[String] $imap_client_buffer = undef,
Optional[String] $pop3_auth = undef,
Optional[Array] $pop3_capabilities = undef,
Optional[String] $smtp_auth = undef,
Optional[Array] $smtp_capabilities = undef,
Optional[Variant[Array, String]] $raw_prepend = undef,
Optional[Variant[Array, String]] $raw_append = undef,
Optional[Hash] $mailhost_cfg_prepend = undef,
Optional[Hash] $mailhost_cfg_append = undef,
String $proxy_pass_error_message = 'off',
Array $server_name = [$name]
Enum['absent', 'present'] $ensure = 'present',
Nginx::Listen::V4 $listen_ip = '*',
Optional[String[1]] $listen_options = undef,
Boolean $ipv6_enable = false,
Nginx::Listen::V6 $ipv6_listen_ip = '::',
Stdlib::Port $ipv6_listen_port = 80,
String $ipv6_listen_options = 'default ipv6only=on',
Boolean $ssl = false,
Optional[String[1]] $ssl_cert = undef,
String $ssl_ciphers = $nginx::ssl_ciphers,
Optional[String[1]] $ssl_client_cert = undef,
Optional[String[1]] $ssl_crl = undef,
Optional[String[1]] $ssl_dhparam = $nginx::ssl_dhparam,
Optional[String[1]] $ssl_ecdh_curve = undef,
Optional[String[1]] $ssl_key = undef,
Optional[String[1]] $ssl_password_file = undef,
Optional[Stdlib::Port] $ssl_port = undef,
Nginx::Toggle $ssl_prefer_server_ciphers = $nginx::ssl_prefer_server_ciphers,
String $ssl_protocols = $nginx::ssl_protocols,
Optional[String[1]] $ssl_session_cache = undef,
Optional[String[1]] $ssl_session_ticket_key = undef,
Optional[Nginx::Toggle] $ssl_session_tickets = undef,
Nginx::Time $ssl_session_timeout = '5m',
Optional[String[1]] $ssl_trusted_cert = undef,
Optional[Integer] $ssl_verify_depth = undef,
Enum['on', 'off', 'only'] $starttls = 'off',
Optional[Enum['imap', 'pop3', 'smtp']] $protocol = undef,
Optional[String[1]] $auth_http = undef,
Optional[String[1]] $auth_http_header = undef,
Nginx::Toggle $xclient = 'on',
Optional[String[1]] $imap_auth = undef,
Optional[Array[String[1]]] $imap_capabilities = undef,
Optional[String[2]] $imap_client_buffer = undef,
Optional[String[1]] $pop3_auth = undef,
Optional[Array[String[1]]] $pop3_capabilities = undef,
Optional[String[1]] $smtp_auth = undef,
Optional[Array[String[1]]] $smtp_capabilities = undef,
Optional[Variant[Array[String[1]], String[1]]] $raw_prepend = undef,
Optional[Variant[Array[String[1]], String[1]]] $raw_append = undef,
Optional[Nginx::Directives] $mailhost_cfg_prepend = undef,
Optional[Nginx::Directives] $mailhost_cfg_append = undef,
Nginx::Toggle $proxy_pass_error_message = 'off',
Array[Stdlib::Host] $server_name = [$name]
) {
if ! defined(Class['nginx']) {
fail('You must include the nginx base class before using any defined resources')
Expand Down
12 changes: 6 additions & 6 deletions manifests/resource/map.pp
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@
# value: 'ny-pool-1'
define nginx::resource::map (
String[2] $string,
Variant[Array, Hash] $mappings,
Optional[String] $default = undef,
Enum['absent', 'present'] $ensure = 'present',
Array[String] $include_files = [],
Boolean $hostnames = false,
Enum['http', 'stream'] $context = 'http',
Variant[Array[Hash[String[1],String]], Hash[String[1],String]] $mappings,
Optional[String[1]] $default = undef,
Enum['absent', 'present'] $ensure = 'present',
Array[String[1]] $include_files = [],
Boolean $hostnames = false,
Enum['http', 'stream'] $context = 'http',
) {
if ! defined(Class['nginx']) {
fail('You must include the nginx base class before using any defined resources')
Expand Down
Loading