Skip to content

Commit

Permalink
Merge pull request #89 from isenthilnatarajan/url_encoded_header
Browse files Browse the repository at this point in the history
Changes to support url encoded header in repose 9
  • Loading branch information
jstraw authored Oct 23, 2019
2 parents eb1b968 + e935428 commit d20013e
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ModuleFile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name 'citops-repose'
version '2.11.0'
version '2.12.0'
description "Repose is an api middleware that provides authentication,
filtering, ratelimitting and several other features, this deploys it."
project_page 'https://github.com/rackerlabs/puppet-repose'
Expand Down
4 changes: 4 additions & 0 deletions manifests/filter/system_model.pp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@
# system-model config.
# Defaults to <tt>false</tt> False
#
# [*encoded_headers*]
# Array of header names that need to be encoded before being sent to the origin service.
#
# === Examples
#
# $app_name = 'repose'
Expand Down Expand Up @@ -137,6 +140,7 @@
$rewrite_host_header = undef,
$service_cluster = undef,
$tracing_header = {},
$encoded_headers = [],
) {

### Validate parameters
Expand Down
4 changes: 3 additions & 1 deletion puppet-module-repose.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
%define base_name repose

Name: puppet-module-%{user}-%{base_name}
Version: 2.11.0
Version: 2.12.0
Release: 1
BuildArch: noarch
Summary: Puppet module to configure %{base_name}
Expand Down Expand Up @@ -30,6 +30,8 @@ cp -pr * %{buildroot}%{module_dir}/
%{module_dir}

%changelog
* Tue Oct 22 2019 Senthil Natarajan <[email protected]> 2.12.0-1
- Added support for url encoded header
* Thu Aug 21 2019 Josh Bell <[email protected]> 2.11.0-1
- Add basic support for Repose 9 in system model and other filters
- Add support for installing identity filter bundle
Expand Down
38 changes: 38 additions & 0 deletions spec/defines/filter/system_model_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -356,5 +356,43 @@
without_content(/services/)
}
end

context 'defaults plus setting repose9 param with encoded headers' do
let :pre_condition do
"class { 'repose': cfg_new_namespace => true }"
end

let(:title) { 'default' }
let(:params) { {
:ensure => 'present',
:repose9 => 'true',
:filename => 'system-model.cfg.xml',
:app_name => 'repose',
:nodes => ['app1', 'app2' ],
:filters => {
10 => { 'name' => 'ip-identity' },
},
:endpoints => [
{
'id' => 'localhost',
'protocol' => 'http',
'hostname' => 'localhost',
'root-path' => '',
'port' => '80',
'default' => 'true'
},
],
:encoded_headers => ['x-user-name', 'x-rax-roles'],

} }
it {
should contain_file('/etc/repose/system-model.cfg.xml').
without_content(/tracing-header/).
without_content(/rewrite-host-header/).
without_content(/repose-cluster/).
without_content(/services/).
with_content(/url-encode-headers="x-user-name,x-rax-roles"/)
}
end
end
end
2 changes: 1 addition & 1 deletion templates/system-model.cfg.xml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<%- end -%>
</services>
<%- end -%>
<destinations>
<destinations <%- if @repose9 && ! @encoded_headers.empty? -%> url-encode-headers="<%= @encoded_headers.join(",")%>" <%- end -%> >
<%- @endpoints.each do |endpoint| -%>
<endpoint <% endpoint.sort.map do |param, value| %><%= param %>="<%= value %>" <% end %>/>
<%- end -%>
Expand Down

0 comments on commit d20013e

Please sign in to comment.