Skip to content

Commit

Permalink
Include apache::mod::filter in apache::mod::deflate
Browse files Browse the repository at this point in the history
This was already done in default mods, but this removes duplication and
allows use without default mods.
  • Loading branch information
ekohl committed Oct 10, 2022
1 parent a121aac commit 9439655
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
9 changes: 0 additions & 9 deletions manifests/default_mods.pp
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,6 @@
include apache::mod::auth_basic

if versioncmp($apache_version, '2.4') >= 0 {
# filter is needed by mod_deflate
include apache::mod::filter

# authz_core is needed for 'Require' directive
::apache::mod { 'authz_core':
id => 'authz_core_module',
Expand All @@ -167,19 +164,13 @@
::apache::mod { 'authz_core':
id => 'authz_core_module',
}

# filter is needed by mod_deflate
include apache::mod::filter
}
} else {
if versioncmp($apache_version, '2.4') >= 0 {
# authz_core is needed for 'Require' directive
::apache::mod { 'authz_core':
id => 'authz_core_module',
}

# filter is needed by mod_deflate
include apache::mod::filter
}
}
}
9 changes: 9 additions & 0 deletions manifests/mod/deflate.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
# @param notes
# A Hash where the key represents the type and the value represents the note name.
#
# @param apache_version
# The version of apache being run.
#
# @see https://httpd.apache.org/docs/current/mod/mod_deflate.html for additional documentation.
#
class apache::mod::deflate (
Expand All @@ -22,8 +25,14 @@
'Output' => 'outstream',
'Ratio' => 'ratio',
}
Optional[String] $apache_version = undef,
) {
include apache

if versioncmp(pick($apache_version, $apache::apache_version), '2.4') >= 0 {
include apache::mod::filter
}

::apache::mod { 'deflate': }

file { 'deflate.conf':
Expand Down
1 change: 1 addition & 0 deletions spec/classes/mod/deflate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# This function is called inside the OS specific contexts
def general_deflate_specs
it { is_expected.to contain_apache__mod('deflate') }
it { is_expected.to contain_class('apache::mod::filter') }

expected = "AddOutputFilterByType DEFLATE application/rss+xml\n"\
"AddOutputFilterByType DEFLATE application/x-javascript\n"\
Expand Down

0 comments on commit 9439655

Please sign in to comment.