File tree 3 files changed +26
-3
lines changed
3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change 2559
2559
concat::fragment { "${name}-serveralias" :
2560
2560
target => " ${priority_real}${filename} .conf" ,
2561
2561
order => 210,
2562
- content => epp(' apache/vhost/_serveralias.epp' , { ' serveraliases' => $serveraliases }),
2562
+ content => epp(' apache/vhost/_serveralias.epp' , { ' serveraliases' => [ $serveraliases ].flatten }),
2563
2563
}
2564
2564
}
2565
2565
Original file line number Diff line number Diff line change 776
776
}
777
777
778
778
it { is_expected . to contain_concat__fragment ( 'rspec.example.com-scriptalias' ) }
779
- it { is_expected . to contain_concat__fragment ( 'rspec.example.com-serveralias' ) }
779
+ it { is_expected . to contain_concat__fragment ( 'rspec.example.com-serveralias' ) . with_content ( %r{^ ServerAlias test-example \. com$} ) }
780
780
781
781
it {
782
782
expect ( subject ) . to contain_concat__fragment ( 'rspec.example.com-setenv' )
1221
1221
it { is_expected . not_to contain_concat__fragment ( 'NameVirtualHost 127.0.0.1:8080' ) }
1222
1222
end
1223
1223
1224
+ describe 'serveraliases parameter' do
1225
+ let ( :params ) { default_params . merge ( serveraliases : serveraliases ) }
1226
+
1227
+ context 'with a string' do
1228
+ let ( :serveraliases ) { 'alias.example.com' }
1229
+
1230
+ it { is_expected . to compile . with_all_deps }
1231
+ it { is_expected . to contain_concat__fragment ( 'rspec.example.com-serveralias' ) . with_content ( %r{^ ServerAlias alias\. example\. com$} ) }
1232
+ end
1233
+
1234
+ context 'with an array' do
1235
+ let ( :serveraliases ) { [ 'alias1.example.com' , 'alias2.example.com' ] }
1236
+
1237
+ it { is_expected . to compile . with_all_deps }
1238
+ it do
1239
+ expect ( subject ) . to contain_concat__fragment ( 'rspec.example.com-serveralias' )
1240
+ . with_content ( %r{^ ServerAlias alias1\. example\. com$} )
1241
+ . with_content ( %r{^ ServerAlias alias2\. example\. com$} )
1242
+ end
1243
+ end
1244
+ end
1245
+
1224
1246
context 'vhost with multiple ip addresses, multiple ports' do
1225
1247
let :params do
1226
1248
{
Original file line number Diff line number Diff line change
1
+ <%- | Array[String] $serveraliases | -%>
1
2
<% unless $serveraliases.empty { -%>
2
3
3
4
## Server aliases
4
- <%- Array( $serveraliases) .each |$serveralias| { -%>
5
+ <%- $serveraliases.each |$serveralias| { -%>
5
6
ServerAlias <%= $serveralias %>
6
7
<%- } -%>
7
8
<% } -%>
You can’t perform that action at this time.
0 commit comments