Skip to content

Commit 6a13c38

Browse files
authored
Merge pull request puppetlabs#1716 from gitkent/feature/disk_cache_ignore
added option to include CacheIgnoreHeaders for disk_cache module
2 parents 6a84fe9 + 1d72b85 commit 6a13c38

File tree

4 files changed

+40
-7
lines changed

4 files changed

+40
-7
lines changed

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -1688,6 +1688,14 @@ class {'::apache::mod::disk_cache':
16881688
}
16891689
```
16901690

1691+
To specify cache ignore headers, pass a string to the `cache_ignore_headers` parameter.
1692+
1693+
``` puppet
1694+
class {'::apache::mod::disk_cache':
1695+
cache_ignore_headers => "Set-Cookie",
1696+
}
1697+
```
1698+
16911699
##### Class: `apache::mod::diskio`
16921700

16931701
Installs and configures [`mod_diskio`][].

manifests/mod/disk_cache.pp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
class apache::mod::disk_cache (
2-
$cache_root = undef,
2+
$cache_root = undef,
3+
$cache_ignore_headers = undef,
34
) {
45
include ::apache
56
if $cache_root {

spec/classes/mod/disk_cache_spec.rb

+27-6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
:is_pe => false,
1616
}
1717
end
18+
19+
let(:params) {
20+
{
21+
:cache_ignore_headers => "Set-Cookie",
22+
}
23+
}
24+
1825
context "with Apache version < 2.4" do
1926
let :pre_condition do
2027
'class{ "apache":
@@ -26,7 +33,7 @@
2633
it { should compile }
2734
it { should contain_class('apache::mod::disk_cache') }
2835
it { is_expected.to contain_apache__mod("disk_cache") }
29-
it { is_expected.to contain_file("disk_cache.conf").with(:content => /CacheEnable disk \/\nCacheRoot \"\/var\/cache\/apache2\/mod_disk_cache\"\nCacheDirLevels 2\nCacheDirLength 1/) }
36+
it { is_expected.to contain_file("disk_cache.conf").with(:content => /CacheEnable disk \/\nCacheRoot \"\/var\/cache\/apache2\/mod_disk_cache\"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie/) }
3037
end
3138
context "with Apache version >= 2.4" do
3239
let :pre_condition do
@@ -40,7 +47,7 @@
4047
it { should contain_class('apache::mod::disk_cache') }
4148
it { should contain_class('apache::mod::cache').that_comes_before('Class[Apache::Mod::Disk_cache]') }
4249
it { is_expected.to contain_apache__mod("cache_disk") }
43-
it { is_expected.to contain_file("disk_cache.conf").with(:content => /CacheEnable disk \/\nCacheRoot \"\/var\/cache\/apache2\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1/) }
50+
it { is_expected.to contain_file("disk_cache.conf").with(:content => /CacheEnable disk \/\nCacheRoot \"\/var\/cache\/apache2\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie/) }
4451
end
4552
end
4653

@@ -57,6 +64,13 @@
5764
:is_pe => false,
5865
}
5966
end
67+
68+
let(:params) {
69+
{
70+
:cache_ignore_headers => "Set-Cookie",
71+
}
72+
}
73+
6074
context "with Apache version < 2.4" do
6175
let :pre_condition do
6276
'class{ "apache":
@@ -66,7 +80,7 @@
6680
}'
6781
end
6882
it { is_expected.to contain_apache__mod("disk_cache") }
69-
it { is_expected.to contain_file("disk_cache.conf").with(:content => /CacheEnable disk \/\nCacheRoot \"\/var\/cache\/mod_proxy\"\nCacheDirLevels 2\nCacheDirLength 1/) }
83+
it { is_expected.to contain_file("disk_cache.conf").with(:content => /CacheEnable disk \/\nCacheRoot \"\/var\/cache\/mod_proxy\"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie/) }
7084
end
7185
context "with Apache version >= 2.4" do
7286
let :pre_condition do
@@ -77,7 +91,7 @@
7791
}'
7892
end
7993
it { is_expected.to contain_apache__mod("cache_disk") }
80-
it { is_expected.to contain_file("disk_cache.conf").with(:content => /CacheEnable disk \/\nCacheRoot \"\/var\/cache\/httpd\/proxy\"\nCacheDirLevels 2\nCacheDirLength 1/) }
94+
it { is_expected.to contain_file("disk_cache.conf").with(:content => /CacheEnable disk \/\nCacheRoot \"\/var\/cache\/httpd\/proxy\"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie/) }
8195
end
8296
end
8397
context "on a FreeBSD OS" do
@@ -93,6 +107,13 @@
93107
:is_pe => false,
94108
}
95109
end
110+
111+
let(:params) {
112+
{
113+
:cache_ignore_headers => "Set-Cookie",
114+
}
115+
}
116+
96117
context "with Apache version < 2.4" do
97118
let :pre_condition do
98119
'class{ "apache":
@@ -105,7 +126,7 @@
105126
it { should contain_class('apache::mod::disk_cache') }
106127
it { should contain_class('apache::mod::cache').that_comes_before('Class[Apache::Mod::Disk_cache]') }
107128
it { is_expected.to contain_apache__mod("disk_cache") }
108-
it { is_expected.to contain_file("disk_cache.conf").with(:content => /CacheEnable disk \/\nCacheRoot \"\/var\/cache\/mod_disk_cache\"\nCacheDirLevels 2\nCacheDirLength 1/) }
129+
it { is_expected.to contain_file("disk_cache.conf").with(:content => /CacheEnable disk \/\nCacheRoot \"\/var\/cache\/mod_disk_cache\"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie/) }
109130
end
110131
context "with Apache version >= 2.4" do
111132
let :pre_condition do
@@ -119,7 +140,7 @@
119140
it { should contain_class('apache::mod::disk_cache') }
120141
it { should contain_class('apache::mod::cache').that_comes_before('Class[Apache::Mod::Disk_cache]') }
121142
it { is_expected.to contain_apache__mod("cache_disk") }
122-
it { is_expected.to contain_file("disk_cache.conf").with(:content => /CacheEnable disk \/\nCacheRoot \"\/var\/cache\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1/) }
143+
it { is_expected.to contain_file("disk_cache.conf").with(:content => /CacheEnable disk \/\nCacheRoot \"\/var\/cache\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie/) }
123144
end
124145
end
125146
end

templates/mod/disk_cache.conf.erb

+3
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ CacheEnable disk /
22
CacheRoot "<%= @_cache_root %>"
33
CacheDirLevels 2
44
CacheDirLength 1
5+
<% if @cache_ignore_headers -%>
6+
CacheIgnoreHeaders <%= @cache_ignore_headers -%>
7+
<% end -%>

0 commit comments

Comments
 (0)