diff --git a/spec/acceptance/vhost_spec.rb b/spec/acceptance/vhost_spec.rb index 109dc9da81..e3b5f3883d 100644 --- a/spec/acceptance/vhost_spec.rb +++ b/spec/acceptance/vhost_spec.rb @@ -859,6 +859,10 @@ class { 'apache': } docroot => '/tmp', options => ['Indexes','FollowSymLinks', 'ExecCGI'], } + apache::vhost { 'test.empty_options': + docroot => '/tmp', + options => [], + } MANIFEST it 'applies cleanly' do apply_manifest(pp, catch_failures: true) @@ -949,6 +953,10 @@ class { 'apache': } it { is_expected.to be_file } it { is_expected.to contain 'Options Indexes FollowSymLinks ExecCGI' } end + describe file("#{apache_hash['vhost_dir']}/25-test.empty_options.conf") do + it { is_expected.to be_file } + it { is_expected.not_to contain 'Options' } + end end context 'when a manifest defines $servername' do diff --git a/templates/vhost/_directories.erb b/templates/vhost/_directories.erb index b33301023c..137ef7eabc 100644 --- a/templates/vhost/_directories.erb +++ b/templates/vhost/_directories.erb @@ -37,7 +37,7 @@ <%- if ! directory['geoip_enable'].nil? -%> GeoIPEnable <%= scope.call_function('apache::bool2httpd', [directory['geoip_enable']]) %> <%- end -%> - <%- if directory['options'] -%> + <%- if directory['options'] && Array(directory['options']).any? -%> Options <%= Array(directory['options']).join(' ') %> <%- end -%> <%- if provider == 'Directory' -%>