From 324179e7a4ae4eee043084f3ac8c44c19e1e87f6 Mon Sep 17 00:00:00 2001 From: cdenneen Date: Thu, 31 Jul 2014 13:59:37 -0400 Subject: [PATCH] Add include files to locations --- manifests/resource/location.pp | 4 ++++ spec/defines/resource_location_spec.rb | 9 +++++++++ templates/vhost/location_footer.erb | 5 +++++ 3 files changed, 18 insertions(+) diff --git a/manifests/resource/location.pp b/manifests/resource/location.pp index 1f44fba34..353e5b192 100644 --- a/manifests/resource/location.pp +++ b/manifests/resource/location.pp @@ -159,6 +159,7 @@ $location_cfg_append = undef, $location_custom_cfg_prepend = undef, $location_custom_cfg_append = undef, + $include = undef, $try_files = undef, $proxy_cache = false, $proxy_cache_valid = false, @@ -258,6 +259,9 @@ if ($location_cfg_append != undef) { validate_hash($location_cfg_append) } + if ($include != undef) { + validate_array($include) + } if ($try_files != undef) { validate_array($try_files) } diff --git a/spec/defines/resource_location_spec.rb b/spec/defines/resource_location_spec.rb index 9fc3989a9..dc49fbe87 100644 --- a/spec/defines/resource_location_spec.rb +++ b/spec/defines/resource_location_spec.rb @@ -179,6 +179,15 @@ ' test3 subtest2 "sub test value2";', ], }, + { + :title => 'should contain include directives', + :attr => 'include', + :value => [ '/file1', '/file2' ], + :match => [ + %r'^\s+include\s+/file1;', + %r'^\s+include\s+/file2;', + ], + }, { :title => 'should contain custom appended directives', :attr => 'location_custom_cfg_append', diff --git a/templates/vhost/location_footer.erb b/templates/vhost/location_footer.erb index 3dc8db678..b947d69b9 100644 --- a/templates/vhost/location_footer.erb +++ b/templates/vhost/location_footer.erb @@ -32,6 +32,11 @@ <%- Array(@raw_append).each do |line| -%> <%= line %> <%- end -%> +<% end -%> +<% if @include -%> + <% @include.each do |include_file| -%> + include <%= include_file %>; + <%- end -%> <% end -%> }