From d78f978e2c1fbed468bcef98c64f0d0c938f7bfb Mon Sep 17 00:00:00 2001 From: Johannes Schillinger Date: Mon, 13 Jun 2022 11:53:10 +0200 Subject: [PATCH 1/4] [Issue 2247] fix datatype of vhost:headers from String to Array Fix wrong introduction of Dataype String to headers parameter The code requires the parameter to be Array[String] to work properly --- manifests/vhost.pp | 2 +- spec/defines/vhost_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/vhost.pp b/manifests/vhost.pp index ad0c312146..81c9df229a 100644 --- a/manifests/vhost.pp +++ b/manifests/vhost.pp @@ -1853,7 +1853,7 @@ Optional[Variant[Array[String],String]] $redirectmatch_status = undef, Optional[Variant[Array[String],String]] $redirectmatch_regexp = undef, Optional[Variant[Array[String],String]] $redirectmatch_dest = undef, - Optional[String] $headers = undef, + Array[String] $headers = [], Optional[Array[String]] $request_headers = undef, Optional[Array[String]] $filters = undef, Optional[Array] $rewrites = undef, diff --git a/spec/defines/vhost_spec.rb b/spec/defines/vhost_spec.rb index f79fb4065e..e45a0644d2 100644 --- a/spec/defines/vhost_spec.rb +++ b/spec/defines/vhost_spec.rb @@ -385,7 +385,7 @@ 'redirectmatch_status' => ['404'], 'redirectmatch_regexp' => ['\.git$'], 'redirectmatch_dest' => ['http://www.example.com'], - 'headers' => 'Set X-Robots-Tag "noindex, noarchive, nosnippet"', + 'headers' => ['Set X-Robots-Tag "noindex, noarchive, nosnippet"', 'Accept: text/html'], 'request_headers' => ['append MirrorID "mirror 12"'], 'rewrites' => [ { From 75c730f7fe4f2c522344e2f54d880835faacd0ab Mon Sep 17 00:00:00 2001 From: Johannes Schillinger Date: Mon, 13 Jun 2022 15:03:20 +0200 Subject: [PATCH 2/4] [Issue 2247] adapt headers example in documentation --- manifests/vhost.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/vhost.pp b/manifests/vhost.pp index 81c9df229a..8370fe018d 100644 --- a/manifests/vhost.pp +++ b/manifests/vhost.pp @@ -1409,7 +1409,7 @@ # docroot => '/path/to/directory', # directories => { # path => '/path/to/directory', -# headers => 'Set X-Robots-Tag "noindex, noarchive, nosnippet"', +# headers => ['Set X-Robots-Tag "noindex, noarchive, nosnippet"'], # }, # } # ``` From ac7cbf61978523f2109e6df7405754c9bd9f1d28 Mon Sep 17 00:00:00 2001 From: Johannes Schillinger Date: Tue, 14 Jun 2022 12:19:55 +0200 Subject: [PATCH 3/4] [Issue 2247] make declaration of type consistend, adapt check accoridngly --- manifests/vhost.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/vhost.pp b/manifests/vhost.pp index 8370fe018d..b4ef8a4f5c 100644 --- a/manifests/vhost.pp +++ b/manifests/vhost.pp @@ -1853,7 +1853,7 @@ Optional[Variant[Array[String],String]] $redirectmatch_status = undef, Optional[Variant[Array[String],String]] $redirectmatch_regexp = undef, Optional[Variant[Array[String],String]] $redirectmatch_dest = undef, - Array[String] $headers = [], + Optional[Array[String]] $headers = undef, Optional[Array[String]] $request_headers = undef, Optional[Array[String]] $filters = undef, Optional[Array] $rewrites = undef, @@ -2260,7 +2260,7 @@ } # Check if mod_headers is required to process $headers/$request_headers - if $headers or $request_headers { + if ($headers and ! empty($headers)) or ( $request_headers and ! empty($request_headers)){ if ! defined(Class['apache::mod::headers']) { include apache::mod::headers } From 257f0ef57dbb16fc45c2dc0a6b568aa09b84bdfc Mon Sep 17 00:00:00 2001 From: Johannes Schillinger Date: Wed, 15 Jun 2022 09:57:34 +0200 Subject: [PATCH 4/4] [Issue 2247] fix linting errors --- manifests/vhost.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/vhost.pp b/manifests/vhost.pp index b4ef8a4f5c..3bdaefc81d 100644 --- a/manifests/vhost.pp +++ b/manifests/vhost.pp @@ -2260,7 +2260,7 @@ } # Check if mod_headers is required to process $headers/$request_headers - if ($headers and ! empty($headers)) or ( $request_headers and ! empty($request_headers)){ + if ($headers and ! empty ($headers)) or ($request_headers and ! empty($request_headers)) { if ! defined(Class['apache::mod::headers']) { include apache::mod::headers }