Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically include mod_expires if required via vhost directories #2559

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions manifests/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2362,6 +2362,10 @@
if 'setenv' in $directory {
include apache::mod::env
}

if 'expires_active' in $directory or 'expires_default' in $directory or 'expires_by_type' in $directory {
include apache::mod::expires
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing to note: apache::mod::expires by default writes down a configuration file (unlike other modules). That could be a behavior difference and break setups. Is that a problem?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we have other modules that do that and thus we include them differently?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like

::apache::mod { 'expires': }

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is exactly the point I tried to make and I'm surprised that CI didn't fail on this:

::apache::mod { 'expires': }

::apache::mod { 'expires': }

It feels ugly, but perhaps we should have some helper class that is only the module definition without the configuration file.

}
}

# Template uses:
Expand Down
5 changes: 5 additions & 0 deletions spec/defines/vhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,10 @@
}
}
},
{
'path' => '/expires',
'expires_active' => true,
},
],
'error_log' => false,
'error_log_file' => 'httpd_error_log',
Expand Down Expand Up @@ -593,6 +597,7 @@
it { is_expected.to contain_class('apache::mod::authz_groupfile') }
it { is_expected.to contain_class('apache::mod::auth_gssapi') }
it { is_expected.to contain_class('apache::mod::env') }
it { is_expected.to contain_class('apache::mod::expires') }
it { is_expected.to contain_class('apache::mod::filter') }
it { is_expected.to contain_class('apache::mod::headers') }
it { is_expected.to contain_class('apache::mod::mime') }
Expand Down
Loading