Skip to content

Commit 42d8124

Browse files
committed
Simplify the template
1 parent 032e713 commit 42d8124

File tree

2 files changed

+25
-21
lines changed

2 files changed

+25
-21
lines changed

spec/classes/pulpcore_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@
224224
.with_priority('10')
225225
.with_content(
226226
<<CONTENT
227+
227228
<Location "/pulp/content">
228229
RequestHeader unset X-CLIENT-CERT
229230
RequestHeader set X-CLIENT-CERT "%{SSL_CLIENT_CERT}s" env=SSL_CLIENT_CERT
@@ -240,18 +241,21 @@
240241
.with_priority('10')
241242
.with_content(
242243
<<CONTENT
244+
243245
<Location "/pulp/content">
244246
RequestHeader unset X-CLIENT-CERT
245247
RequestHeader set X-CLIENT-CERT "%{SSL_CLIENT_CERT}s" env=SSL_CLIENT_CERT
246248
ProxyPass http://127.0.0.1:24816/pulp/content
247249
ProxyPassReverse http://127.0.0.1:24816/pulp/content
248250
</Location>
251+
249252
<Location "/pulp/api/v3">
250253
RequestHeader unset REMOTE_USER
251254
RequestHeader set REMOTE_USER "%{SSL_CLIENT_S_DN_CN}s" env=SSL_CLIENT_S_DN_CN
252255
ProxyPass http://127.0.0.1:24817/pulp/api/v3
253256
ProxyPassReverse http://127.0.0.1:24817/pulp/api/v3
254257
</Location>
258+
255259
ProxyPass /assets/ http://127.0.0.1:24817/assets/
256260
ProxyPassReverse /assets/ http://127.0.0.1:24817/assets/
257261
CONTENT

templates/apache-fragment.epp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@
1111
Optional[reverse_urls] => Array[String[1]],
1212
}]],
1313
}]] $directories,
14-
Optional[Array[Hash[String, String]]] $proxy_pass = undef,
14+
Array[Hash[String, String]] $proxy_pass = [],
1515
| -%>
16-
<%-
17-
$directories.each |$directory| {
18-
if $directory['provider'] =~ /^(.*)match$/ {
19-
$provider = $1.capitalize + 'Match'
20-
} else {
21-
$provider = $directory['provider'].capitalize
22-
}
23-
-%>
16+
<%- $directories.each |$directory| { -%>
17+
18+
<%-
19+
if $directory['provider'] =~ /^(.*)match$/ {
20+
$provider = $1.capitalize + 'Match'
21+
} else {
22+
$provider = $directory['provider'].capitalize
23+
}
24+
-%>
2425
<<%= $provider %> "<%= $directory['path'] %>">
2526
<%- if $directory['options'] { -%>
2627
Options <%= $directory['options'].join(' ') %>
@@ -36,25 +37,24 @@ $directories.each |$directory| {
3637
<%- } -%>
3738
<%- } -%>
3839
<%- if $directory['proxy_pass'] and $provider in ['Location', 'LocationMatch'] { -%>
39-
<%- $directory['proxy_pass'].each |$proxy| { -%>
40+
<%- $directory['proxy_pass'].each |$proxy| { -%>
4041
ProxyPass <%= $proxy['url'] -%>
41-
<%- if $proxy['params'] { -%>
42-
<%- $proxy['params'].sort.each |$key, $value| { -%> <%= $key %>=<%= $value -%><%- } -%>
43-
<%- } %>
44-
<%- if $proxy['reverse_urls'] { -%>
45-
<%- $proxy['reverse_urls'].each |$reverse_url| { -%>
42+
<%- if $proxy['params'] { -%>
43+
<%- $proxy['params'].sort.each |$key, $value| { -%> <%= $key %>=<%= $value -%><%- } -%>
44+
<%- } %>
45+
<%- if $proxy['reverse_urls'] { -%>
46+
<%- $proxy['reverse_urls'].each |$reverse_url| { -%>
4647
ProxyPassReverse <%= $reverse_url %>
47-
<%- } -%>
48-
<%- } else { -%>
48+
<%- } -%>
49+
<%- } else { -%>
4950
ProxyPassReverse <%= $proxy['url'] %>
50-
<%- } -%>
51-
<%- } -%>
51+
<%- } -%>
52+
<%- } -%>
5253
<%- } -%>
5354
</<%= $provider %>>
5455
<% } -%>
55-
<% if $proxy_pass { -%>
5656
<% $proxy_pass.each |$proxy| { -%>
57+
5758
ProxyPass <%= $proxy['path'] %> <%= $proxy['url'] %>
5859
ProxyPassReverse <%= $proxy['path'] %> <%= $proxy['url'] %>
5960
<% } -%>
60-
<% } -%>

0 commit comments

Comments
 (0)