Skip to content

Commit

Permalink
Fix apache::vhost::error_documents data type
Browse files Browse the repository at this point in the history
The template in templates/vhost/_error_document.erb is only functionnal
if we pass an array of hashes.  This is going to be simplified in a
future commit so only accept values that produce working configuration
and reject configuration that is invalid and ignored.
  • Loading branch information
smortex committed May 4, 2024
1 parent 6bb6333 commit da18fc6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion manifests/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -1798,7 +1798,7 @@
Optional[Variant[String, Boolean]] $modsec_audit_log = undef,
Optional[String] $modsec_audit_log_file = undef,
Optional[String] $modsec_audit_log_pipe = undef,
Variant[Array[Hash], String] $error_documents = [],
Array[Apache::Errordocument] $error_documents = [],
Optional[Variant[Stdlib::Absolutepath, Enum['disabled']]] $fallbackresource = undef,
Optional[String] $scriptalias = undef,
Optional[Integer] $limitreqfieldsize = undef,
Expand Down
7 changes: 6 additions & 1 deletion spec/defines/vhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,12 @@
'error_log_file' => 'httpd_error_log',
'error_log_syslog' => true,
'error_log_format' => ['[%t] [%l] %7F: %E: [client\ %a] %M% ,\ referer\ %{Referer}i'],
'error_documents' => 'true',
'error_documents' => [
{
'error_code' => '500',
'document' => '/server-error.html',
},
],
'fallbackresource' => '/index.php',
'scriptalias' => '/usr/lib/cgi-bin',
'limitreqfieldsize' => 8190,
Expand Down
5 changes: 5 additions & 0 deletions types/errordocument.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# @summary A mapping for an error code and a document
type Apache::Errordocument = Struct[
error_code => Variant[String[3, 3], Integer[400, 599]],
document => String[1],
]

0 comments on commit da18fc6

Please sign in to comment.