From 33303102fcba17da2c19dd68ef1adda30400395b Mon Sep 17 00:00:00 2001 From: "Carl P. Corliss" Date: Mon, 23 Jun 2014 17:26:20 -0400 Subject: [PATCH] refactor locations to remove a bit of redundancy --- manifests/resource/location.pp | 24 ++++-- templates/vhost/location_footer.erb | 31 ++++++++ templates/vhost/location_header.erb | 41 ++++++++++ templates/vhost/locations/alias.erb | 4 + templates/vhost/locations/directory.erb | 21 +++++ templates/vhost/locations/empty.erb | 15 ++++ templates/vhost/locations/fastcgi.erb | 14 ++++ templates/vhost/locations/proxy.erb | 26 +++++++ templates/vhost/locations/stub_status.erb | 1 + templates/vhost/vhost_location_alias.erb | 56 ------------- templates/vhost/vhost_location_directory.erb | 65 ---------------- templates/vhost/vhost_location_empty.erb | 13 ---- templates/vhost/vhost_location_fastcgi.erb | 66 ---------------- templates/vhost/vhost_location_proxy.erb | 78 ------------------- .../vhost/vhost_location_stub_status.erb | 53 ------------- 15 files changed, 169 insertions(+), 339 deletions(-) create mode 100644 templates/vhost/location_footer.erb create mode 100644 templates/vhost/location_header.erb create mode 100644 templates/vhost/locations/alias.erb create mode 100644 templates/vhost/locations/directory.erb create mode 100644 templates/vhost/locations/empty.erb create mode 100644 templates/vhost/locations/fastcgi.erb create mode 100644 templates/vhost/locations/proxy.erb create mode 100644 templates/vhost/locations/stub_status.erb delete mode 100644 templates/vhost/vhost_location_alias.erb delete mode 100644 templates/vhost/vhost_location_directory.erb delete mode 100644 templates/vhost/vhost_location_empty.erb delete mode 100644 templates/vhost/vhost_location_fastcgi.erb delete mode 100644 templates/vhost/vhost_location_proxy.erb delete mode 100644 templates/vhost/vhost_location_stub_status.erb diff --git a/manifests/resource/location.pp b/manifests/resource/location.pp index fca744935..d6783a3d2 100644 --- a/manifests/resource/location.pp +++ b/manifests/resource/location.pp @@ -258,17 +258,17 @@ # Use proxy or fastcgi template if $proxy is defined, otherwise use directory template. if ($proxy != undef) { - $content_real = template('nginx/vhost/vhost_location_proxy.erb') + $content_real = template('nginx/vhost/locations/proxy.erb') } elsif ($location_alias != undef) { - $content_real = template('nginx/vhost/vhost_location_alias.erb') + $content_real = template('nginx/vhost/locations/alias.erb') } elsif ($stub_status != undef) { - $content_real = template('nginx/vhost/vhost_location_stub_status.erb') + $content_real = template('nginx/vhost/locations/stub_status.erb') } elsif ($fastcgi != undef) { - $content_real = template('nginx/vhost/vhost_location_fastcgi.erb') + $content_real = template('nginx/vhost/locations/fastcgi.erb') } elsif ($www_root != undef) { - $content_real = template('nginx/vhost/vhost_location_directory.erb') + $content_real = template('nginx/vhost/locations/directory.erb') } else { - $content_real = template('nginx/vhost/vhost_location_empty.erb') + $content_real = template('nginx/vhost/locations/empty.erb') } if $fastcgi != undef and !defined(File[$fastcgi_params]) { @@ -286,7 +286,11 @@ concat::fragment { "${tmpFile}": ensure => present, target => $config_file, - content => $content_real, + content => join([ + template('nginx/vhost/location_header.erb'), + $content_real, + template('nginx/vhost/location_footer.erb') + ], ''), order => "${priority}", } } @@ -299,7 +303,11 @@ concat::fragment {"${sslTmpFile}": ensure => present, target => $config_file, - content => $content_real, + content => join([ + template('nginx/vhost/location_header.erb'), + $content_real, + template('nginx/vhost/location_footer.erb') + ], ''), order => "${ssl_priority}", } } diff --git a/templates/vhost/location_footer.erb b/templates/vhost/location_footer.erb new file mode 100644 index 000000000..de7ada6c6 --- /dev/null +++ b/templates/vhost/location_footer.erb @@ -0,0 +1,31 @@ +<% if @location_cfg_append -%> + <%- @location_cfg_append.sort_by {|k,v| k}.each do |key,value| -%> + <%- if value.is_a?(Hash) -%> + <%- value.each do |subkey,subvalue| -%> + <%- Array(subvalue).each do |asubvalue| -%> + <%= key %> <%= subkey %> <%= asubvalue %>; + <%- end -%> + <%- end -%> + <%- else -%> + <%- Array(value).each do |asubvalue| -%> + <%= key %> <%= asubvalue %>; + <%- end -%> + <%- end -%> + <%- end -%> +<% end -%> +<% if @location_custom_cfg_append -%> + <%- @location_custom_cfg_append.each do |key,value| -%> + <%- if value.is_a?(Hash) -%> + <%- value.each do |subkey,subvalue| -%> + <%- Array(subvalue).each do |asubvalue| -%> + <%= key %> <%= subkey %> <%= asubvalue %> + <%- end -%> + <%- end -%> + <%- else -%> + <%- Array(value).each do |asubvalue| -%> + <%= key %> <%= asubvalue %> + <%- end -%> + <%- end -%> + <%- end -%> +<% end -%> + } diff --git a/templates/vhost/location_header.erb b/templates/vhost/location_header.erb new file mode 100644 index 000000000..2e897f3d6 --- /dev/null +++ b/templates/vhost/location_header.erb @@ -0,0 +1,41 @@ + location <%= @location %> { +<% if @location_allow -%> + <%- @location_allow.each do |allow_rule| -%> + allow <%= allow_rule %>; + <%- end -%> +<% end -%> +<% if @location_deny -%> + <%- @location_deny.each do |deny_rule| -%> + deny <%= deny_rule %>; + <%- end -%> +<% end -%> +<% if @location_custom_cfg_prepend -%> + <%- @location_custom_cfg_prepend.each do |key,value| -%> + <%- if value.is_a?(Hash) -%> + <%- value.each do |subkey,subvalue| -%> + <%- Array(subvalue).each do |asubvalue| -%> + <%= key %> <%= subkey %> <%= asubvalue %> + <%- end -%> + <%- end -%> + <%- else -%> + <%- Array(value).each do |asubvalue| -%> + <%= key %> <%= asubvalue %> + <%- end -%> + <%- end -%> + <%- end -%> +<% end -%> +<% if @location_cfg_prepend -%> + <%- @location_cfg_prepend.sort_by {|k,v| k}.each do |key,value| -%> + <%- if value.is_a?(Hash) -%> + <%- value.each do |subkey,subvalue| -%> + <%- Array(subvalue).each do |asubvalue| -%> + <%= key %> <%= subkey %> <%= asubvalue %>; + <%- end -%> + <%- end -%> + <%- else -%> + <%- Array(value).each do |asubvalue| -%> + <%= key %> <%= asubvalue %>; + <%- end -%> + <%- end -%> + <%- end -%> +<% end -%> diff --git a/templates/vhost/locations/alias.erb b/templates/vhost/locations/alias.erb new file mode 100644 index 000000000..4189541bf --- /dev/null +++ b/templates/vhost/locations/alias.erb @@ -0,0 +1,4 @@ + alias <%= @location_alias %>; +<% if defined? @autoindex -%> + autoindex <%= @autoindex %>; +<% end -%> diff --git a/templates/vhost/locations/directory.erb b/templates/vhost/locations/directory.erb new file mode 100644 index 000000000..e06c748b6 --- /dev/null +++ b/templates/vhost/locations/directory.erb @@ -0,0 +1,21 @@ +<% if defined? @www_root -%> + root <%= @www_root %>; +<% end -%> +<% if @try_files -%> + try_files<% @try_files.each do |try| -%> <%= try %><% end -%>; +<% end -%> +<% if defined? @autoindex -%> + autoindex <%= @autoindex %>; +<% end -%> +<% if @index_files.count > 0 -%> + index <% Array(@index_files).each do |i| %> <%= i %><% end %>; +<% end -%> +<% @rewrite_rules.each do |rewrite_rule| -%> + rewrite <%= rewrite_rule %>; +<% end -%> +<% if defined? @auth_basic -%> + auth_basic "<%= @auth_basic %>"; +<% end -%> +<% if defined? @auth_basic_user_file -%> + auth_basic_user_file <%= @auth_basic_user_file %>; +<% end -%> diff --git a/templates/vhost/locations/empty.erb b/templates/vhost/locations/empty.erb new file mode 100644 index 000000000..48c57eba9 --- /dev/null +++ b/templates/vhost/locations/empty.erb @@ -0,0 +1,15 @@ +<% if @location_custom_cfg -%> + <%- @location_custom_cfg.sort_by {|k,v| k}.each do |key,value| -%> + <%- if value.is_a?(Hash) -%> + <%- value.each do |subkey,subvalue| -%> + <%- Array(subvalue).each do |asubvalue| -%> + <%= key %> <%= subkey %> <%= asubvalue %>; + <%- end -%> + <%- end -%> + <%- else -%> + <%- Array(value).each do |asubvalue| -%> + <%= key %> <%= asubvalue %>; + <%- end -%> + <%- end -%> + <%- end -%> +<% end -%> diff --git a/templates/vhost/locations/fastcgi.erb b/templates/vhost/locations/fastcgi.erb new file mode 100644 index 000000000..505fe102b --- /dev/null +++ b/templates/vhost/locations/fastcgi.erb @@ -0,0 +1,14 @@ +<% if defined? @www_root -%> + root <%= @www_root %>; +<% end -%> +<% if @fastcgi_split_path -%> + fastcgi_split_path_info <%= @fastcgi_split_path %>; +<% end -%> +<% if @try_files -%> + try_files<% @try_files.each do |try| -%> <%= try %><% end -%>; +<% end -%> + include <%= @fastcgi_params %>; + fastcgi_pass <%= @fastcgi %>; +<% if defined? @fastcgi_script %> + fastcgi_param SCRIPT_FILENAME <%= @fastcgi_script %>; +<% end -%> diff --git a/templates/vhost/locations/proxy.erb b/templates/vhost/locations/proxy.erb new file mode 100644 index 000000000..8f3ccae37 --- /dev/null +++ b/templates/vhost/locations/proxy.erb @@ -0,0 +1,26 @@ +<% if @proxy_cache -%> + proxy_cache <%= @proxy_cache %>; + proxy_cache_valid <%= @proxy_cache_valid %>; +<% end -%> + proxy_pass <%= @proxy %>; + proxy_read_timeout <%= @proxy_read_timeout %>; + proxy_connect_timeout <%= @proxy_connect_timeout %>; + proxy_redirect <%= @proxy_redirect %>; +<% @proxy_set_header.each do |header| -%> + proxy_set_header <%= header %>; +<% end -%> +<% if @proxy_method -%> + proxy_method <%= @proxy_method %>; +<% end -%> +<% if @proxy_set_body -%> + proxy_set_body <%= @proxy_set_body %>; +<% end -%> +<% @rewrite_rules.each do |rewrite_rule| -%> + rewrite <%= rewrite_rule %>; +<% end -%> +<% if defined? @auth_basic -%> + auth_basic "<%= @auth_basic %>"; +<% end -%> +<% if defined? @auth_basic_user_file -%> + auth_basic_user_file <%= @auth_basic_user_file %>; +<% end -%> diff --git a/templates/vhost/locations/stub_status.erb b/templates/vhost/locations/stub_status.erb new file mode 100644 index 000000000..a00929410 --- /dev/null +++ b/templates/vhost/locations/stub_status.erb @@ -0,0 +1 @@ + stub_status on; diff --git a/templates/vhost/vhost_location_alias.erb b/templates/vhost/vhost_location_alias.erb deleted file mode 100644 index dbe230db2..000000000 --- a/templates/vhost/vhost_location_alias.erb +++ /dev/null @@ -1,56 +0,0 @@ - location <%= @location %> { -<% if @location_allow -%><% @location_allow.each do |allow_rule| -%> - allow <%= allow_rule %>; -<% end -%><% end -%> -<% if @location_deny -%><% @location_deny.each do |deny_rule| -%> - deny <%= deny_rule %>; -<% end -%><% end -%> -<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |key,value| -%> -<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= subkey %> <%= asubvalue %> -<% end -%> -<% end -%><% else -%> -<% Array(value).each do |asubvalue| -%> - <%= key %> <%= asubvalue %> -<% end -%> -<% end -%> -<% end -%><% end -%> -<% if @location_cfg_prepend -%><% @location_cfg_prepend.sort_by {|k,v| k}.each do |key,value| -%> -<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= subkey %> <%= asubvalue %>; -<% end -%> -<% end -%><% else -%> -<% Array(value).each do |asubvalue| -%> - <%= key %> <%= asubvalue %>; -<% end -%> -<% end -%> -<% end -%><% end -%> - alias <%= @location_alias %>; -<% if defined? @autoindex -%> - autoindex <%= @autoindex %>; -<% end -%> -<% if @location_cfg_append -%><% @location_cfg_append.sort_by {|k,v| k}.each do |key,value| -%> -<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= subkey %> <%= asubvalue %>; -<% end -%> -<% end -%><% else -%> -<% Array(value).each do |asubvalue| -%> - <%= key %> <%= asubvalue %>; -<% end -%> -<% end -%> -<% end -%><% end -%> -<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%> -<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= subkey %> <%= asubvalue %> -<% end -%> -<% end -%><% else -%> -<% Array(value).each do |asubvalue| -%> - <%= key %> <%= asubvalue %> -<% end -%> -<% end -%> -<% end -%><% end -%> - } diff --git a/templates/vhost/vhost_location_directory.erb b/templates/vhost/vhost_location_directory.erb deleted file mode 100644 index 3ab9be2e9..000000000 --- a/templates/vhost/vhost_location_directory.erb +++ /dev/null @@ -1,65 +0,0 @@ - location <%= @location %> { -<% if @location_allow -%><% @location_allow.each do |allow_rule| -%> - allow <%= allow_rule %>; -<% end -%><% end -%> -<% if @location_deny -%><% @location_deny.each do |deny_rule| -%> - deny <%= deny_rule %>; -<% end -%><% end -%> -<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |value| -%> - <%= value %> -<% end -%><% end -%> -<% if @location_cfg_prepend -%><% @location_cfg_prepend.sort_by {|k,v| k}.each do |key,value| -%> -<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= subkey %> <%= asubvalue %>; -<% end -%> -<% end -%><% else -%> -<% Array(value).each do |asubvalue| -%> - <%= key %> <%= asubvalue %>; -<% end -%> -<% end -%> -<% end -%><% end -%> -<% if defined? @www_root -%> - root <%= @www_root %>; -<% end -%> -<% if @try_files -%> - try_files<% @try_files.each do |try| -%> <%= try %><% end -%>; -<% end -%> -<% if defined? @autoindex -%> - autoindex <%= @autoindex %>; -<% end -%> -<% if @index_files.count > 0 -%> - index <% Array(@index_files).each do |i| %> <%= i %><% end %>; -<% end -%> -<% @rewrite_rules.each do |rewrite_rule| -%> - rewrite <%= rewrite_rule %>; -<% end -%> -<% if defined? @auth_basic -%> - auth_basic "<%= @auth_basic %>"; -<% end -%> -<% if defined? @auth_basic_user_file -%> - auth_basic_user_file <%= @auth_basic_user_file %>; -<% end -%> -<% if @location_cfg_append -%><% @location_cfg_append.sort_by {|k,v| k}.each do |key,value| -%> -<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= subkey %> <%= asubvalue %>; -<% end -%> -<% end -%><% else -%> -<% Array(value).each do |asubvalue| -%> - <%= key %> <%= asubvalue %>; -<% end -%> -<% end -%> -<% end -%><% end -%> -<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%> -<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= subkey %> <%= asubvalue %> -<% end -%> -<% end -%><% else -%> -<% Array(value).each do |asubvalue| -%> - <%= key %> <%= asubvalue %> -<% end -%> -<% end -%> -<% end -%><% end -%> - } diff --git a/templates/vhost/vhost_location_empty.erb b/templates/vhost/vhost_location_empty.erb deleted file mode 100644 index 10f0d3c6c..000000000 --- a/templates/vhost/vhost_location_empty.erb +++ /dev/null @@ -1,13 +0,0 @@ - location <%= @location %> { -<% if @location_custom_cfg -%><% @location_custom_cfg.sort_by {|k,v| k}.each do |key,value| -%> -<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= subkey %> <%= asubvalue %>; -<% end -%> -<% end -%><% else -%> -<% Array(value).each do |asubvalue| -%> - <%= key %> <%= asubvalue %>; -<% end -%> -<% end -%> -<% end -%><% end -%> - } diff --git a/templates/vhost/vhost_location_fastcgi.erb b/templates/vhost/vhost_location_fastcgi.erb deleted file mode 100644 index ecb38b109..000000000 --- a/templates/vhost/vhost_location_fastcgi.erb +++ /dev/null @@ -1,66 +0,0 @@ - location <%= @location %> { -<% if @location_allow -%><% @location_allow.each do |allow_rule| -%> - allow <%= allow_rule %>; -<% end -%><% end -%> -<% if @location_deny -%><% @location_deny.each do |deny_rule| -%> - deny <%= deny_rule %>; -<% end -%><% end -%> -<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |key,value| -%> -<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= subkey %> <%= asubvalue %> -<% end -%> -<% end -%><% else -%> -<% Array(value).each do |asubvalue| -%> - <%= key %> <%= asubvalue %> -<% end -%> -<% end -%> -<% end -%><% end -%> -<% if @location_cfg_prepend -%><% @location_cfg_prepend.sort_by {|k,v| k}.each do |key,value| -%> -<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= subkey %> <%= asubvalue %>; -<% end -%> -<% end -%><% else -%> -<% Array(value).each do |asubvalue| -%> - <%= key %> <%= asubvalue %>; -<% end -%> -<% end -%> -<% end -%><% end -%> -<% if defined? @www_root -%> - root <%= @www_root %>; -<% end -%> -<% if @fastcgi_split_path -%> - fastcgi_split_path_info <%= @fastcgi_split_path %>; -<% end -%> -<% if @try_files -%> - try_files<% @try_files.each do |try| -%> <%= try %><% end -%>; -<% end -%> - include <%= @fastcgi_params %>; - fastcgi_pass <%= @fastcgi %>; -<% if defined? @fastcgi_script %> - fastcgi_param SCRIPT_FILENAME <%= @fastcgi_script %>; -<% end -%> -<% if @location_cfg_append -%><% @location_cfg_append.sort_by {|k,v| k}.each do |key,value| -%> -<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= subkey %> <%= asubvalue %>; -<% end -%> -<% end -%><% else -%> -<% Array(value).each do |asubvalue| -%> - <%= key %> <%= asubvalue %>; -<% end -%> -<% end -%> -<% end -%><% end -%> -<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%> -<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= subkey %> <%= asubvalue %> -<% end -%> -<% end -%><% else -%> -<% Array(value).each do |asubvalue| -%> - <%= key %> <%= asubvalue %> -<% end -%> -<% end -%> -<% end -%><% end -%> - } diff --git a/templates/vhost/vhost_location_proxy.erb b/templates/vhost/vhost_location_proxy.erb deleted file mode 100644 index 80b2be0c0..000000000 --- a/templates/vhost/vhost_location_proxy.erb +++ /dev/null @@ -1,78 +0,0 @@ - location <%= @location %> { -<% if @location_allow -%><% @location_allow.each do |allow_rule| -%> - allow <%= allow_rule %>; -<% end -%><% end -%> -<% if @location_deny -%><% @location_deny.each do |deny_rule| -%> - deny <%= deny_rule %>; -<% end -%><% end -%> -<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |key,value| -%> -<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= subkey %> <%= asubvalue %> -<% end -%> -<% end -%><% else -%> -<% Array(value).each do |asubvalue| -%> - <%= key %> <%= asubvalue %> -<% end -%> -<% end -%> -<% end -%><% end -%> -<% if @location_cfg_prepend -%><% @location_cfg_prepend.sort_by {|k,v| k}.each do |key,value| -%> -<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%=subkey %> <%= asubvalue %>; -<% end -%> -<% end -%><% else -%> -<% Array(value).each do |asubvalue| -%> - <%= key %> <%= asubvalue %>; -<% end -%> -<% end -%> -<% end -%><% end -%> -<% if @proxy_cache -%> - proxy_cache <%= @proxy_cache %>; - proxy_cache_valid <%= @proxy_cache_valid %>; -<% end -%> - proxy_pass <%= @proxy %>; - proxy_read_timeout <%= @proxy_read_timeout %>; - proxy_connect_timeout <%= @proxy_connect_timeout %>; - proxy_redirect <%= @proxy_redirect %>; -<% @proxy_set_header.each do |header| -%> - proxy_set_header <%= header %>; -<% end -%> -<% if @proxy_method -%> - proxy_method <%= @proxy_method %>; -<% end -%> -<% if @proxy_set_body -%> - proxy_set_body <%= @proxy_set_body %>; -<% end -%> -<% @rewrite_rules.each do |rewrite_rule| -%> - rewrite <%= rewrite_rule %>; -<% end -%> -<% if defined? @auth_basic -%> - auth_basic "<%= @auth_basic %>"; -<% end -%> -<% if defined? @auth_basic_user_file -%> - auth_basic_user_file <%= @auth_basic_user_file %>; -<% end -%> -<% if @location_cfg_append -%><% @location_cfg_append.sort_by {|k,v| k}.each do |key,value| -%> -<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= subkey %> <%= asubvalue %>; -<% end -%> -<% end -%><% else -%> -<% Array(value).each do |asubvalue| -%> - <%= key %> <%= asubvalue %>; -<% end -%> -<% end -%> -<% end -%><% end -%> -<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%> -<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= subkey %> <%= asubvalue %> -<% end -%> -<% end -%><% else -%> -<% Array(value).each do |asubvalue| -%> - <%= key %> <%= asubvalue %> -<% end -%> -<% end -%> -<% end -%><% end -%> - } diff --git a/templates/vhost/vhost_location_stub_status.erb b/templates/vhost/vhost_location_stub_status.erb deleted file mode 100644 index 592c981c0..000000000 --- a/templates/vhost/vhost_location_stub_status.erb +++ /dev/null @@ -1,53 +0,0 @@ - location <%= @location %> { -<% if @location_allow -%><% @location_allow.each do |allow_rule| -%> - allow <%= allow_rule %>; -<% end -%><% end -%> -<% if @location_deny -%><% @location_deny.each do |deny_rule| -%> - deny <%= deny_rule %>; -<% end -%><% end -%> -<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |key,value| -%> -<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= subkey %> <%= asubvalue %> -<% end -%> -<% end -%><% else -%> -<% Array(value).each do |asubvalue| -%> - <%= key %> <%= asubvalue %> -<% end -%> -<% end -%> -<% end -%><% end -%> -<% if @location_cfg_prepend -%><% @location_cfg_prepend.sort_by {|k,v| k}.each do |key,value| -%> -<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= subkey %> <%= asubvalue %>; -<% end -%> -<% end -%><% else -%> -<% Array(value).each do |asubvalue| -%> - <%= key %> <%= asubvalue %>; -<% end -%> -<% end -%> -<% end -%><% end -%> - stub_status on; -<% if @location_cfg_append -%><% @location_cfg_append.sort_by {|k,v| k}.each do |key,value| -%> -<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= subkey %> <%= asubvalue %>; -<% end -%> -<% end -%><% else -%> -<% Array(value).each do |asubvalue| -%> - <%= key %> <%= asubvalue %>; -<% end -%> -<% end -%> -<% end -%><% end -%> -<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%> -<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= subkey %> <%= asubvalue %> -<% end -%> -<% end -%><% else -%> -<% Array(value).each do |asubvalue| -%> - <%= key %> <%= asubvalue %> -<% end -%> -<% end -%> -<% end -%><% end -%> - }