Skip to content

Commit 6bc1072

Browse files
authored
Merge pull request #2312 from bovy89/main
fix directory empty options if an empty array is being used
2 parents 4922544 + d9ba8d3 commit 6bc1072

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

spec/acceptance/vhost_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,10 @@ class { 'apache': }
859859
docroot => '/tmp',
860860
options => ['Indexes','FollowSymLinks', 'ExecCGI'],
861861
}
862+
apache::vhost { 'test.empty_options':
863+
docroot => '/tmp',
864+
options => [],
865+
}
862866
MANIFEST
863867
it 'applies cleanly' do
864868
apply_manifest(pp, catch_failures: true)
@@ -949,6 +953,10 @@ class { 'apache': }
949953
it { is_expected.to be_file }
950954
it { is_expected.to contain 'Options Indexes FollowSymLinks ExecCGI' }
951955
end
956+
describe file("#{apache_hash['vhost_dir']}/25-test.empty_options.conf") do
957+
it { is_expected.to be_file }
958+
it { is_expected.not_to contain 'Options' }
959+
end
952960
end
953961

954962
context 'when a manifest defines $servername' do

templates/vhost/_directories.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<%- if ! directory['geoip_enable'].nil? -%>
3838
GeoIPEnable <%= scope.call_function('apache::bool2httpd', [directory['geoip_enable']]) %>
3939
<%- end -%>
40-
<%- if directory['options'] -%>
40+
<%- if directory['options'] && Array(directory['options']).any? -%>
4141
Options <%= Array(directory['options']).join(' ') %>
4242
<%- end -%>
4343
<%- if provider == 'Directory' -%>

0 commit comments

Comments
 (0)