Skip to content

Commit b6d6c6e

Browse files
CIDM-1566 - Add via-header and repose-version to container config
1 parent f11a75f commit b6d6c6e

File tree

4 files changed

+41
-1
lines changed

4 files changed

+41
-1
lines changed

manifests/filter/container.pp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,20 @@
189189
#
190190
# [*via*]
191191
# String. String used in the Via header.
192+
# Deprecated, to be removed in Repose 9.0.0.0
192193
# Defaults to <tt>undef</tt>
193194
#
195+
# [*via_header*]
196+
# Hash. Hash containing any or all of the following optional keys:
197+
# request-prefix, response-prefix, and/or repose-version. The keys
198+
# request-prefix and response-prefix are simple Strings, the key repose-version
199+
# is a Boolean. This can not be set at the same time as the `via` option - it
200+
# will result in an unparsable file by Repose.
201+
# Requires Repose version 8.4.1.0 or higher
202+
# Example:
203+
# via_header = { 'response-prefix' => 'Salad', 'repose-version' => 'false' }
204+
# Defaults to <tt>{}</tt>
205+
#
194206
# [*log_herp_flume*]
195207
# Enable herp filter publishing to flume.
196208
# Defaults to <tt>false</tt>
@@ -311,6 +323,7 @@
311323
$syslog_port = $repose::params::syslog_port,
312324
$syslog_protocol = $repose::params::syslog_protocol,
313325
$via = undef,
326+
$via_header = {},
314327
$flume_host = $repose::params::flume_host,
315328
$flume_port = $repose::params::flume_port,
316329
# BELOW ARE DEPRECATED
@@ -351,6 +364,11 @@
351364
debug("\$ensure = '${ensure}'")
352365
}
353366

367+
## error if both via options are used which would produce an unparsable config
368+
if ($via and $via_header!={}) {
369+
fail("The parameters \'via\' and \'via_header\' can not be used at the same time. The paramater \'via_header\' requires Repose v8.4.10 or newer.")
370+
}
371+
354372
if $log_use_log4j2 == true {
355373
$logging_configuration_real = 'log4j2.xml'
356374
# also merge logger options hashes.

puppet-module-repose.spec

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
%define base_name repose
33

44
Name: puppet-module-%{user}-%{base_name}
5-
Version: 2.8.0
5+
Version: 2.9.0
66
Release: 1
77
BuildArch: noarch
88
Summary: Puppet module to configure %{base_name}
@@ -30,6 +30,8 @@ cp -pr * %{buildroot}%{module_dir}/
3030
%{module_dir}
3131

3232
%changelog
33+
* Mon Dec 17 2018 Josh Bell <[email protected]> - 2.9.0-1
34+
- Add via_header and repose_version options to container filter
3335
* Mon May 12 2018 Josh Bell <[email protected]> - 2.8.0-1
3436
- Add ssl protocol and tls renegotiation options to container filter
3537
* Mon Apr 02 2018 Dimitry Ushakov <[email protected]> - 2.7.0-1

spec/classes/filter/container_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,18 @@
397397
}
398398
end
399399

400+
context 'define via_header option' do
401+
let(:params) { {
402+
:app_name => 'app',
403+
:via_header => { 'response-header' => 'Salad', 'repose-version' => 'false' }
404+
} }
405+
it {
406+
should contain_file('/etc/repose/container.cfg.xml').
407+
with_content(/response-header="Salad"/).
408+
with_content(/repose-version="false"/)
409+
}
410+
end
411+
400412
context 'with defaults with old namespace' do
401413
let :pre_condition do
402414
"class { 'repose': cfg_new_namespace => false }"

templates/container.cfg.xml.erb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@
4242
<logging-configuration href="<%= @logging_configuration %>"/>
4343
<%- end -%>
4444

45+
<%- if @via_header -%>
46+
<via-header
47+
<%- @via_header.each_pair do | name, value| -%>
48+
<%= name %>="<%= value %>"
49+
<%- end -%>
50+
/>
51+
<%- end %>
52+
4553
<%- if @ssl_enabled == true -%>
4654
<ssl-configuration>
4755
<keystore-filename><%= @ssl_keystore_filename %></keystore-filename>

0 commit comments

Comments
 (0)