diff --git a/manifests/init.pp b/manifests/init.pp index 3e28d2e2b..c75bd2e69 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -40,6 +40,10 @@ # already installed. If the fact is unavailable, it defaults to '1.6.0'. # You may need to set this manually to get a working and idempotent # configuration. +# +# @param debug_connections +# Configures nginx `debug_connection` lines in the `events` section of the nginx config. +# See http://nginx.org/en/docs/ngx_core_module.html#debug_connection class nginx ( ### START Nginx Configuration ### Variant[Stdlib::Absolutepath, Boolean] $client_body_temp_path = $nginx::params::client_body_temp_path, diff --git a/spec/classes/nginx_spec.rb b/spec/classes/nginx_spec.rb index 02478e1b6..91ecb3bb2 100644 --- a/spec/classes/nginx_spec.rb +++ b/spec/classes/nginx_spec.rb @@ -1077,6 +1077,15 @@ attr: 'ssl_password_file', value: '/path/to/password_file', match: ' ssl_password_file /path/to/password_file;' + }, + { + title: 'should contain debug_connection directives', + attr: 'debug_connections', + value: %w[127.0.0.1 unix:], + match: [ + ' debug_connection 127.0.0.1;', + ' debug_connection unix:;' + ] } ].each do |param| context "when #{param[:attr]} is #{param[:value]}" do diff --git a/spec/type_aliases/debugconnection_spec.rb b/spec/type_aliases/debugconnection_spec.rb new file mode 100644 index 000000000..d9d4cb4cd --- /dev/null +++ b/spec/type_aliases/debugconnection_spec.rb @@ -0,0 +1,10 @@ +require 'spec_helper' + +describe 'Nginx::DebugConnection' do + it { is_expected.to allow_value('127.0.0.1') } + it { is_expected.to allow_value('localhost') } + it { is_expected.to allow_value('192.0.2.0/24') } + it { is_expected.to allow_value('::1') } + it { is_expected.to allow_value('2001:0db8::/32') } + it { is_expected.to allow_value('unix:') } +end diff --git a/types/debugconnection.pp b/types/debugconnection.pp index 67b8388bc..399fc4bb5 100644 --- a/types/debugconnection.pp +++ b/types/debugconnection.pp @@ -1 +1 @@ -type Nginx::DebugConnection = Variant[Stdlib::Host, Enum['unix:']] +type Nginx::DebugConnection = Variant[Stdlib::Host, Stdlib::IP::Address, Enum['unix:']]