Skip to content

Commit 72f4f98

Browse files
committed
Fixing typing issues in response to spec failures
1 parent 286d32e commit 72f4f98

File tree

4 files changed

+26
-19
lines changed

4 files changed

+26
-19
lines changed

manifests/init.pp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@
3939
Stdlib::Unixpath $log_dir = $::nginx::params::log_dir,
4040
String[1] $log_group = $::nginx::params::log_group,
4141
Stdlib::Filemode $log_mode = '0750',
42-
Variant[Stdlib::Unixpath, Array[Stdlib::Unixpath]] $http_access_log = "${log_dir}/${::nginx::params::http_access_log_file}",
42+
Variant[String[1], Array[String[1]]] $http_access_log = "${log_dir}/${::nginx::params::http_access_log_file}",
4343
Optional[String[1]] $http_format_log = undef,
44-
Variant[Stdlib::Unixpath, Array[Stdlib::Unixpath]] $nginx_error_log = "${log_dir}/${::nginx::params::nginx_error_log_file}",
44+
Variant[String[1], Array[String[1]]] $nginx_error_log = "${log_dir}/${::nginx::params::nginx_error_log_file}",
4545
Nginx::ErrorLogSeverity $nginx_error_log_severity = 'error',
4646
Optional[Stdlib::Unixpath] $pid = $::nginx::params::pid,
4747
Stdlib::Unixpath $proxy_temp_path = $::nginx::params::proxy_temp_path,
@@ -83,12 +83,12 @@
8383
String[1] $gzip_proxied = 'off',
8484
Optional[Variant[Array[String[1]], String[1]]] $gzip_types = undef,
8585
Nginx::Toggle $gzip_vary = 'off',
86-
Optional[Variant[Hash[String[1],String], Array[String[1]]]] $http_cfg_prepend = undef,
87-
Optional[Variant[Hash[String[1],String], Array[String[1]]]] $http_cfg_append = undef,
88-
Optional[Variant[Array[String[1]], String[1]]] $http_raw_prepend = undef,
89-
Optional[Variant[Array[String[1]], String[1]]] $http_raw_append = undef,
86+
Optional[Variant[Hash, Array]] $http_cfg_prepend = undef,
87+
Optional[Variant[Hash, Array]] $http_cfg_append = undef,
88+
Optional[Variant[Hash, Array]] $http_raw_prepend = undef,
89+
Optional[Variant[Hash, Array]] $http_raw_append = undef,
9090
Nginx::Toggle $http_tcp_nodelay = 'on',
91-
Nginx::Toggle $http_tcp_nopush = 'off',
91+
Optional[Nginx::Toggle] $http_tcp_nopush = undef,
9292
Nginx::Duration $keepalive_timeout = '65s',
9393
String[1] $keepalive_requests = '100',
9494
Hash[String[1],String] $log_format = {},
@@ -97,7 +97,7 @@
9797
Nginx::Toggle $multi_accept = 'off',
9898
Integer $names_hash_bucket_size = 64,
9999
Integer $names_hash_max_size = 512,
100-
Optional[Variant[Hash[String[1],String], Tuple[String]]] $nginx_cfg_prepend = undef,
100+
Optional[Variant[Hash, Array]] $nginx_cfg_prepend = undef,
101101
String[1] $proxy_buffers = '32 4k',
102102
String[1] $proxy_buffer_size = '8k',
103103
Nginx::Duration $proxy_cache_inactive = '20m',
@@ -124,7 +124,7 @@
124124
Array[String[1]] $proxy_hide_header = [],
125125
Array[String[1]] $proxy_pass_header = [],
126126
Array[String[1]] $proxy_ignore_header = [],
127-
Nginx::Toggle $sendfile = 'on',
127+
Optional[Nginx::Toggle] $sendfile = undef,
128128
String[1] $server_tokens = 'on',
129129
Boolean $spdy = false,
130130
Boolean $http2 = false,

manifests/resource/streamhost.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
Variant[Array[Stdlib::Ipv6], Stdlib::Ipv6] $ipv6_listen_ip = '::',
5656
Stdlib::Port $ipv6_listen_port = 80,
5757
String[1] $ipv6_listen_options = 'default ipv6only=on',
58-
Optional[Stdlib::Httpurl] $proxy = undef,
58+
Optional[String[1]] $proxy = undef,
5959
Nginx::Duration $proxy_read_timeout = $::nginx::proxy_read_timeout,
6060
Nginx::Duration $proxy_connect_timeout = $::nginx::proxy_connect_timeout,
6161
Array[String[1]] $resolver = [],

spec/classes/nginx_spec.rb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@
425425
{
426426
title: 'should not set pid',
427427
attr: 'pid',
428-
value: false,
428+
value: :undef,
429429
notmatch: %r{pid}
430430
},
431431
{
@@ -516,15 +516,21 @@
516516
match: ' access_log /var/log/nginx/access.log mycustomformat;'
517517
},
518518
{
519-
title: 'should set sendfile',
519+
title: 'should set sendfile on',
520520
attr: 'sendfile',
521521
value: 'on',
522522
match: ' sendfile on;'
523523
},
524+
{
525+
title: 'should set sendfile off',
526+
attr: 'sendfile',
527+
value: 'off',
528+
match: ' sendfile off;'
529+
},
524530
{
525531
title: 'should not set sendfile',
526532
attr: 'sendfile',
527-
value: false,
533+
value: :undef,
528534
notmatch: %r{sendfile}
529535
},
530536
{
@@ -827,7 +833,7 @@
827833
{
828834
title: 'should not set proxy_http_version',
829835
attr: 'proxy_http_version',
830-
value: nil,
836+
value: :undef,
831837
notmatch: 'proxy_http_version'
832838
},
833839
{

templates/conf.d/nginx.conf.erb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,13 @@ http {
7575
access_log <%= @http_access_log %><% if @http_format_log %> <%= @http_format_log%><% end %>;
7676
<% end -%>
7777

78-
<% if @sendfile == 'on' -%>
79-
sendfile on;
80-
<%- if @http_tcp_nopush == 'on' -%>
81-
tcp_nopush on;
82-
<%- end -%>
78+
<% if @sendfile -%>
79+
sendfile <%= @sendfile %>;
8380
<% end -%>
81+
<%- if @http_tcp_nopush -%>
82+
tcp_nopush <%= @http_tcp_nopush %>;
83+
<%- end -%>
84+
8485
server_tokens <%= @server_tokens %>;
8586

8687
types_hash_max_size <%= @types_hash_max_size %>;

0 commit comments

Comments
 (0)