From dd898c2a0a473e9417bb41cc44231cb5d2fc7a71 Mon Sep 17 00:00:00 2001 From: eSe Date: Sun, 9 Mar 2014 20:46:13 +0100 Subject: [PATCH 1/4] Fix syntax errors --- templates/vhost/vhost_header.erb | 1 + templates/vhost/vhost_location_alias.erb | 1 + templates/vhost/vhost_location_directory.erb | 1 + templates/vhost/vhost_location_empty.erb | 6 ------ templates/vhost/vhost_location_proxy.erb | 1 + templates/vhost/vhost_ssl_footer.erb | 1 + 6 files changed, 5 insertions(+), 6 deletions(-) diff --git a/templates/vhost/vhost_header.erb b/templates/vhost/vhost_header.erb index 37d581378..1a4053ca6 100644 --- a/templates/vhost/vhost_header.erb +++ b/templates/vhost/vhost_header.erb @@ -23,6 +23,7 @@ server { <% Array(subvalue).each do |asubvalue| -%> <%= key %> <%= asubkey %> <%= asubvalue %>; <% end %> +<% end %> <% end -%><% else -%> <% Array(value).each do |sub| -%> <%= key %> <%= sub %>; diff --git a/templates/vhost/vhost_location_alias.erb b/templates/vhost/vhost_location_alias.erb index f26bc3a11..4b6d994a2 100644 --- a/templates/vhost/vhost_location_alias.erb +++ b/templates/vhost/vhost_location_alias.erb @@ -8,6 +8,7 @@ <% Array(subvalue).each do |asubvalue| -%> <%= key %> <%= asubkey %> <%= asubvalue %>; <% end %> +<% end %> <% end -%><% else -%> <% Array(value).each do |sub| -%> <%= key %> <%= sub %>; diff --git a/templates/vhost/vhost_location_directory.erb b/templates/vhost/vhost_location_directory.erb index 0b4980c20..11e051117 100644 --- a/templates/vhost/vhost_location_directory.erb +++ b/templates/vhost/vhost_location_directory.erb @@ -18,6 +18,7 @@ <% end -%><% else -%> <% Array(value).each do |sub| -%> <%= key %> <%= sub %>; +<% end %> <% end -%> <% end -%><% end -%> <% if defined? @www_root -%> diff --git a/templates/vhost/vhost_location_empty.erb b/templates/vhost/vhost_location_empty.erb index ab0384a2f..627a36403 100644 --- a/templates/vhost/vhost_location_empty.erb +++ b/templates/vhost/vhost_location_empty.erb @@ -7,15 +7,9 @@ <% end %> <% end %> <% end -%><% else -%> -<% Array(value).each do |sub| -%> - <%= key %> <%= sub %>; -<% end %> - <%= key %> <%= subkey %> <%= subvalue %>; -<% end -%><% else -%> <% Array(value).each do |sub| -%> <%= key %> <%= sub %>; <% end %> <% end -%> <% end -%><% end -%> } - diff --git a/templates/vhost/vhost_location_proxy.erb b/templates/vhost/vhost_location_proxy.erb index 1d63981be..be7d9f767 100644 --- a/templates/vhost/vhost_location_proxy.erb +++ b/templates/vhost/vhost_location_proxy.erb @@ -47,6 +47,7 @@ <% Array(value).each do |sub| -%> <%= key %> <%= sub %>; <% end %> +<% end -%> <% end -%><% end -%> <% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |value| -%> <%= value %>; diff --git a/templates/vhost/vhost_ssl_footer.erb b/templates/vhost/vhost_ssl_footer.erb index e7aeec513..4085f75d1 100644 --- a/templates/vhost/vhost_ssl_footer.erb +++ b/templates/vhost/vhost_ssl_footer.erb @@ -15,6 +15,7 @@ include <%= file %>; <% end -%> <% end -%><% end -%> <% if @vhost_cfg_ssl_append -%><% @vhost_cfg_ssl_append.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%> +<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> <% Array(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> <%= key %> <%= asubkey %> <%= asubvalue %>; From 3ef66c6f6392c88a64392533b756bb2f6d51a724 Mon Sep 17 00:00:00 2001 From: eSe Date: Mon, 10 Mar 2014 10:26:35 +0100 Subject: [PATCH 2/4] Fix formatting errors --- templates/vhost/vhost_footer.erb | 8 ++++---- templates/vhost/vhost_header.erb | 6 +++--- templates/vhost/vhost_location_alias.erb | 12 ++++++------ templates/vhost/vhost_location_directory.erb | 12 ++++++------ templates/vhost/vhost_location_empty.erb | 6 +++--- templates/vhost/vhost_location_fastcgi.erb | 12 ++++++------ templates/vhost/vhost_location_proxy.erb | 12 ++++++------ templates/vhost/vhost_location_stub_status.erb | 12 ++++++------ templates/vhost/vhost_ssl_footer.erb | 12 ++++++------ templates/vhost/vhost_ssl_header.erb | 12 ++++++------ 10 files changed, 52 insertions(+), 52 deletions(-) diff --git a/templates/vhost/vhost_footer.erb b/templates/vhost/vhost_footer.erb index a37c4b40f..9558c9058 100644 --- a/templates/vhost/vhost_footer.erb +++ b/templates/vhost/vhost_footer.erb @@ -9,12 +9,12 @@ include <%= file %>; <% Array(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end %> -<% end %> +<% end -%> +<% end -%> <% end -%><% else -%> <% Array(value).each do |sub| -%> <%= key %> <%= sub %>; -<% end %> +<% end -%> <% end -%> <% end -%><% end -%> } @@ -24,4 +24,4 @@ server { server_name www.<%= @name.gsub(/^www\./, '') %>; rewrite ^ http://<%= @name.gsub(/^www\./, '') %>$uri permanent; } -<% end %> +<% end -%> diff --git a/templates/vhost/vhost_header.erb b/templates/vhost/vhost_header.erb index 1a4053ca6..40429e220 100644 --- a/templates/vhost/vhost_header.erb +++ b/templates/vhost/vhost_header.erb @@ -22,12 +22,12 @@ server { <% Array(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end %> -<% end %> +<% end -%> +<% end -%> <% end -%><% else -%> <% Array(value).each do |sub| -%> <%= key %> <%= sub %>; -<% end %> +<% end -%> <% end -%> <% end -%><% end -%> <% if @root -%> diff --git a/templates/vhost/vhost_location_alias.erb b/templates/vhost/vhost_location_alias.erb index 4b6d994a2..12d623c16 100644 --- a/templates/vhost/vhost_location_alias.erb +++ b/templates/vhost/vhost_location_alias.erb @@ -7,12 +7,12 @@ <% Array(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end %> -<% end %> +<% end -%> +<% end -%> <% end -%><% else -%> <% Array(value).each do |sub| -%> <%= key %> <%= sub %>; -<% end %> +<% end -%> <% end -%> <% end -%><% end -%> alias <%= @location_alias %>; @@ -21,12 +21,12 @@ <% Array(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end %> -<% end %> +<% end -%> +<% end -%> <% end -%><% else -%> <% Array(value).each do |sub| -%> <%= key %> <%= sub %>; -<% end %> +<% end -%> <% end -%> <% end -%><% end -%> <% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |value| -%> diff --git a/templates/vhost/vhost_location_directory.erb b/templates/vhost/vhost_location_directory.erb index 11e051117..e3c45a775 100644 --- a/templates/vhost/vhost_location_directory.erb +++ b/templates/vhost/vhost_location_directory.erb @@ -13,12 +13,12 @@ <% Array(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end %> -<% end %> +<% end -%> +<% end -%> <% end -%><% else -%> <% Array(value).each do |sub| -%> <%= key %> <%= sub %>; -<% end %> +<% end -%> <% end -%> <% end -%><% end -%> <% if defined? @www_root -%> @@ -47,12 +47,12 @@ <% Array(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end %> -<% end %> +<% end -%> +<% end -%> <% end -%><% else -%> <% Array(value).each do |sub| -%> <%= key %> <%= sub %>; -<% end %> +<% end -%> <% end -%> <% end -%><% end -%> <% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |value| -%> diff --git a/templates/vhost/vhost_location_empty.erb b/templates/vhost/vhost_location_empty.erb index 627a36403..a8223761b 100644 --- a/templates/vhost/vhost_location_empty.erb +++ b/templates/vhost/vhost_location_empty.erb @@ -4,12 +4,12 @@ <% Array(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end %> -<% end %> +<% end -%> +<% end -%> <% end -%><% else -%> <% Array(value).each do |sub| -%> <%= key %> <%= sub %>; -<% end %> +<% end -%> <% end -%> <% end -%><% end -%> } diff --git a/templates/vhost/vhost_location_fastcgi.erb b/templates/vhost/vhost_location_fastcgi.erb index 012eeacfb..906bc2c8d 100644 --- a/templates/vhost/vhost_location_fastcgi.erb +++ b/templates/vhost/vhost_location_fastcgi.erb @@ -7,12 +7,12 @@ <% Array(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end %> -<% end %> +<% end -%> +<% end -%> <% end -%><% else -%> <% Array(value).each do |sub| -%> <%= key %> <%= sub %>; -<% end %> +<% end -%> <% end -%> <% end -%><% end -%> <% if defined? @www_root -%> @@ -34,12 +34,12 @@ <% Array(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end %> -<% end %> +<% end -%> +<% end -%> <% end -%><% else -%> <% Array(value).each do |sub| -%> <%= key %> <%= sub %>; -<% end %> +<% end -%> <% end -%> <% end -%><% end -%> <% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |value| -%> diff --git a/templates/vhost/vhost_location_proxy.erb b/templates/vhost/vhost_location_proxy.erb index be7d9f767..410aa6c72 100644 --- a/templates/vhost/vhost_location_proxy.erb +++ b/templates/vhost/vhost_location_proxy.erb @@ -13,12 +13,12 @@ <% Array(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end %> -<% end %> +<% end -%> +<% end -%> <% end -%><% else -%> <% Array(value).each do |sub| -%> <%= key %> <%= sub %>; -<% end %> +<% end -%> <% end -%> <% end -%><% end -%> <% if @proxy_cache -%> @@ -41,12 +41,12 @@ <% Array(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end %> -<% end %> +<% end -%> +<% end -%> <% end -%><% else -%> <% Array(value).each do |sub| -%> <%= key %> <%= sub %>; -<% end %> +<% end -%> <% end -%> <% end -%><% end -%> <% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |value| -%> diff --git a/templates/vhost/vhost_location_stub_status.erb b/templates/vhost/vhost_location_stub_status.erb index 88ebaf9a8..2866afd1e 100644 --- a/templates/vhost/vhost_location_stub_status.erb +++ b/templates/vhost/vhost_location_stub_status.erb @@ -7,12 +7,12 @@ <% Array(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end %> -<% end %> +<% end -%> +<% end -%> <% end -%><% else -%> <% Array(value).each do |sub| -%> <%= key %> <%= sub %>; -<% end %> +<% end -%> <% end -%> <% end -%><% end -%> stub_status on; @@ -21,12 +21,12 @@ <% Array(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end %> -<% end %> +<% end -%> +<% end -%> <% end -%><% else -%> <% Array(value).each do |sub| -%> <%= key %> <%= sub %>; -<% end %> +<% end -%> <% end -%> <% end -%><% end -%> <% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |value| -%> diff --git a/templates/vhost/vhost_ssl_footer.erb b/templates/vhost/vhost_ssl_footer.erb index 4085f75d1..a8b2f91aa 100644 --- a/templates/vhost/vhost_ssl_footer.erb +++ b/templates/vhost/vhost_ssl_footer.erb @@ -6,12 +6,12 @@ include <%= file %>; <% Array(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end %> -<% end %> +<% end -%> +<% end -%> <% end -%><% else -%> <% Array(value).each do |sub| -%> <%= key %> <%= sub %>; -<% end %> +<% end -%> <% end -%> <% end -%><% end -%> <% if @vhost_cfg_ssl_append -%><% @vhost_cfg_ssl_append.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%> @@ -19,12 +19,12 @@ include <%= file %>; <% Array(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end %> -<% end %> +<% end -%> +<% end -%> <% end -%><% else -%> <% Array(value).each do |sub| -%> <%= key %> <%= sub %>; -<% end %> +<% end -%> <% end -%> <% end -%><% end -%> } diff --git a/templates/vhost/vhost_ssl_header.erb b/templates/vhost/vhost_ssl_header.erb index eb6d8fa17..61129a008 100644 --- a/templates/vhost/vhost_ssl_header.erb +++ b/templates/vhost/vhost_ssl_header.erb @@ -53,12 +53,12 @@ server { <% Array(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end %> -<% end %> +<% end -%> +<% end -%> <% end -%><% else -%> <% Array(value).each do |sub| -%> <%= key %> <%= sub %>; -<% end %> +<% end -%> <% end -%> <% end -%><% end -%> <% if @vhost_cfg_ssl_prepend -%><% @vhost_cfg_ssl_prepend.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%> @@ -66,12 +66,12 @@ server { <% Array(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end %> -<% end %> +<% end -%> +<% end -%> <% end -%><% else -%> <% Array(value).each do |sub| -%> <%= key %> <%= sub %>; -<% end %> +<% end -%> <% end -%> <% end -%><% end -%> <% if @root -%> From 7614bceec14a9a04b06a4812559a74eb47ac02fa Mon Sep 17 00:00:00 2001 From: eSe Date: Mon, 10 Mar 2014 10:38:16 +0100 Subject: [PATCH 3/4] Fix custom_cfg_[prepend,append] --- templates/vhost/vhost_location_alias.erb | 28 ++++++++++++++++--- templates/vhost/vhost_location_directory.erb | 14 ++++++++-- templates/vhost/vhost_location_fastcgi.erb | 28 ++++++++++++++++--- templates/vhost/vhost_location_proxy.erb | 28 ++++++++++++++++--- .../vhost/vhost_location_stub_status.erb | 28 ++++++++++++++++--- 5 files changed, 108 insertions(+), 18 deletions(-) diff --git a/templates/vhost/vhost_location_alias.erb b/templates/vhost/vhost_location_alias.erb index 12d623c16..0b1b93f4c 100644 --- a/templates/vhost/vhost_location_alias.erb +++ b/templates/vhost/vhost_location_alias.erb @@ -1,6 +1,16 @@ location <%= @location %> { -<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |value| -%> - <%= value %> +<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |key,value| -%> +<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> +<% Array(subkey).each do |asubkey| -%> +<% Array(subvalue).each do |asubvalue| -%> + <%= key %> <%= asubkey %> <%= asubvalue %>; +<% end -%> +<% end -%> +<% end -%><% else -%> +<% Array(value).each do |sub| -%> + <%= key %> <%= sub %>; +<% 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| -%> @@ -29,8 +39,18 @@ <% end -%> <% end -%> <% end -%><% end -%> -<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |value| -%> - <%= value %> +<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%> +<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> +<% Array(subkey).each do |asubkey| -%> +<% Array(subvalue).each do |asubvalue| -%> + <%= key %> <%= asubkey %> <%= asubvalue %>; +<% end -%> +<% end -%> +<% end -%><% else -%> +<% Array(value).each do |sub| -%> + <%= key %> <%= sub %>; +<% end -%> +<% end -%> <% end -%><% end -%> } diff --git a/templates/vhost/vhost_location_directory.erb b/templates/vhost/vhost_location_directory.erb index e3c45a775..74fe306e8 100644 --- a/templates/vhost/vhost_location_directory.erb +++ b/templates/vhost/vhost_location_directory.erb @@ -55,7 +55,17 @@ <% end -%> <% end -%> <% end -%><% end -%> -<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |value| -%> - <%= value %> +<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%> +<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> +<% Array(subkey).each do |asubkey| -%> +<% Array(subvalue).each do |asubvalue| -%> + <%= key %> <%= asubkey %> <%= asubvalue %>; +<% end -%> +<% end -%> +<% end -%><% else -%> +<% Array(value).each do |sub| -%> + <%= key %> <%= sub %>; +<% end -%> +<% end -%> <% end -%><% end -%> } diff --git a/templates/vhost/vhost_location_fastcgi.erb b/templates/vhost/vhost_location_fastcgi.erb index 906bc2c8d..9b56f0bcc 100644 --- a/templates/vhost/vhost_location_fastcgi.erb +++ b/templates/vhost/vhost_location_fastcgi.erb @@ -1,6 +1,16 @@ location <%= @location %> { -<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |value| -%> - <%= value %> +<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |key,value| -%> +<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> +<% Array(subkey).each do |asubkey| -%> +<% Array(subvalue).each do |asubvalue| -%> + <%= key %> <%= asubkey %> <%= asubvalue %>; +<% end -%> +<% end -%> +<% end -%><% else -%> +<% Array(value).each do |sub| -%> + <%= key %> <%= sub %>; +<% 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| -%> @@ -42,8 +52,18 @@ <% end -%> <% end -%> <% end -%><% end -%> -<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |value| -%> - <%= value %> +<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%> +<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> +<% Array(subkey).each do |asubkey| -%> +<% Array(subvalue).each do |asubvalue| -%> + <%= key %> <%= asubkey %> <%= asubvalue %>; +<% end -%> +<% end -%> +<% end -%><% else -%> +<% Array(value).each do |sub| -%> + <%= key %> <%= sub %>; +<% end -%> +<% end -%> <% end -%><% end -%> } diff --git a/templates/vhost/vhost_location_proxy.erb b/templates/vhost/vhost_location_proxy.erb index 410aa6c72..2b8588cac 100644 --- a/templates/vhost/vhost_location_proxy.erb +++ b/templates/vhost/vhost_location_proxy.erb @@ -5,8 +5,18 @@ <% 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 %>; +<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |key,value| -%> +<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> +<% Array(subkey).each do |asubkey| -%> +<% Array(subvalue).each do |asubvalue| -%> + <%= key %> <%= asubkey %> <%= asubvalue %>; +<% end -%> +<% end -%> +<% end -%><% else -%> +<% Array(value).each do |sub| -%> + <%= key %> <%= sub %>; +<% end -%> +<% end -%> <% end -%><% end -%> <% if @location_cfg_prepend -%><% @location_cfg_prepend.each do |key,value| -%> <% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> @@ -49,8 +59,18 @@ <% end -%> <% end -%> <% end -%><% end -%> -<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |value| -%> - <%= value %>; +<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%> +<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> +<% Array(subkey).each do |asubkey| -%> +<% Array(subvalue).each do |asubvalue| -%> + <%= key %> <%= asubkey %> <%= asubvalue %>; +<% end -%> +<% end -%> +<% end -%><% else -%> +<% Array(value).each do |sub| -%> + <%= key %> <%= sub %>; +<% end -%> +<% end -%> <% end -%><% end -%> } diff --git a/templates/vhost/vhost_location_stub_status.erb b/templates/vhost/vhost_location_stub_status.erb index 2866afd1e..66d3a28f9 100644 --- a/templates/vhost/vhost_location_stub_status.erb +++ b/templates/vhost/vhost_location_stub_status.erb @@ -1,6 +1,16 @@ location <%= @location %> { -<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |value| -%> - <%= value %>; +<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |key,value| -%> +<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> +<% Array(subkey).each do |asubkey| -%> +<% Array(subvalue).each do |asubvalue| -%> + <%= key %> <%= asubkey %> <%= asubvalue %>; +<% end -%> +<% end -%> +<% end -%><% else -%> +<% Array(value).each do |sub| -%> + <%= key %> <%= sub %>; +<% 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| -%> @@ -29,8 +39,18 @@ <% end -%> <% end -%> <% end -%><% end -%> -<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |value| -%> - <%= value %>; +<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%> +<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> +<% Array(subkey).each do |asubkey| -%> +<% Array(subvalue).each do |asubvalue| -%> + <%= key %> <%= asubkey %> <%= asubvalue %>; +<% end -%> +<% end -%> +<% end -%><% else -%> +<% Array(value).each do |sub| -%> + <%= key %> <%= sub %>; +<% end -%> +<% end -%> <% end -%><% end -%> } From 0ade406a89e68e2effbd2476b39c76514a94b24e Mon Sep 17 00:00:00 2001 From: eSe Date: Tue, 11 Mar 2014 16:09:59 +0100 Subject: [PATCH 4/4] Remove Arrays as keys in templates --- spec/defines/resource_location_spec.rb | 55 ++++++++----------- templates/vhost/vhost_footer.erb | 8 +-- templates/vhost/vhost_header.erb | 8 +-- templates/vhost/vhost_location_alias.erb | 33 ++++------- templates/vhost/vhost_location_directory.erb | 24 +++----- templates/vhost/vhost_location_empty.erb | 8 +-- templates/vhost/vhost_location_fastcgi.erb | 34 ++++-------- templates/vhost/vhost_location_proxy.erb | 36 +++++------- .../vhost/vhost_location_stub_status.erb | 34 ++++-------- templates/vhost/vhost_ssl_footer.erb | 16 ++---- templates/vhost/vhost_ssl_header.erb | 16 ++---- 11 files changed, 101 insertions(+), 171 deletions(-) diff --git a/spec/defines/resource_location_spec.rb b/spec/defines/resource_location_spec.rb index 12ecef750..893a5d788 100644 --- a/spec/defines/resource_location_spec.rb +++ b/spec/defines/resource_location_spec.rb @@ -46,7 +46,7 @@ :attr => 'location_cfg_prepend', :value => { 'test1' => 'test value 1', 'test2' => ['test value 2a', 'test value 2b'], 'allow' => 'test value 3', 'test4' => { 'subtest1' => ['"sub test value1a"', '"sub test value 1b"'], - ['subtest2a', 'subtest2b'] => '"sub test value2"' } }, + 'subtest2' => '"sub test value2"' } }, :match => [ ' allow test value 3;', ' test1 test value 1;', @@ -54,8 +54,7 @@ ' test2 test value 2b;', ' test4 subtest1 "sub test value1a";', ' test4 subtest1 "sub test value1b";', - ' test4 subtest2a "sub test value2";', - ' test4 subtest2b "sub test value2";', + ' test4 subtest2 "sub test value2";', ], }, { @@ -99,7 +98,7 @@ :attr => 'location_cfg_append', :value => { 'test1' => ['test value 1a', 'test value 1b'], 'test2' => 'test value 2', 'allow' => 'test value 3', 'test4' => { 'subtest1' => ['"sub test value1a"', '"sub test value 1b"'], - ['subtest2a', 'subtest2b'] => '"sub test value2"' } }, + 'subtest2' => '"sub test value2"' } }, :match => [ ' allow test value 3;', ' test1 test value 1a;', @@ -107,8 +106,7 @@ ' test2 test value 2;', ' test4 subtest1 "sub test value1a";', ' test4 subtest1 "sub test value1b";', - ' test4 subtest2a "sub test value2";', - ' test4 subtest2b "sub test value2";', + ' test4 subtest2 "sub test value2";', ], }, { @@ -173,7 +171,7 @@ :attr => 'location_cfg_prepend', :value => { 'test1' => ['test value 1a', 'test value 1b'], 'test2' => 'test value 2', 'allow' => 'test value 3', 'test4' => { 'subtest1' => ['"sub test value1a"', '"sub test value 1b"'], - ['subtest2a', 'subtest2b'] => '"sub test value2"' } }, + 'subtest2' => '"sub test value2"' } }, :match => [ ' allow test value 3;', ' test1 test value 1a;', @@ -181,8 +179,7 @@ ' test2 test value 2;', ' test4 subtest1 "sub test value1a";', ' test4 subtest1 "sub test value1b";', - ' test4 subtest2a "sub test value2";', - ' test4 subtest2b "sub test value2";', + ' test4 subtest2 "sub test value2";', ], }, { @@ -196,7 +193,7 @@ :attr => 'location_cfg_append', :value => { 'test1' => 'test value 1', 'test2' => 'test value 2', 'allow' => ['test value 3a', 'test value 3b', 'test value 3c'], 'test4' => { 'subtest1' => ['"sub test value1a"', '"sub test value 1b"'], - ['subtest2a', 'subtest2b'] => '"sub test value2"' } }, + 'subtest2' => '"sub test value2"' } }, :match => [ ' allow test value 3a;', ' allow test value 3b;', @@ -205,8 +202,7 @@ ' test2 test value 2;', ' test4 subtest1 "sub test value1a";', ' test4 subtest1 "sub test value1b";', - ' test4 subtest2a "sub test value2";', - ' test4 subtest2b "sub test value2";', + ' test4 subtest2 "sub test value2";', ], }, ].each do |param| @@ -239,7 +235,7 @@ :attr => 'location_cfg_prepend', :value => { 'test1' => 'test value 1', 'test2' => ['test value 2a', 'test value 2b'], 'allow' => 'test value 3', 'test4' => { 'subtest1' => ['"sub test value1a"', '"sub test value 1b"'], - ['subtest2a', 'subtest2b'] => '"sub test value2"' } }, + 'subtest2' => '"sub test value2"' } }, :match => [ ' allow test value 3;', ' test1 test value 1;', @@ -247,8 +243,7 @@ ' test2 test value 2b;', ' test4 subtest1 "sub test value1a";', ' test4 subtest1 "sub test value1b";', - ' test4 subtest2a "sub test value2";', - ' test4 subtest2b "sub test value2";', + ' test4 subtest2 "sub test value2";', ], }, { @@ -256,7 +251,7 @@ :attr => 'location_cfg_append', :value => { 'test1' => 'test value 1', 'test2' => ['test value 2a', 'test value 2b'], 'allow' => 'test value 3', 'test4' => { 'subtest1' => ['"sub test value1a"', '"sub test value 1b"'], - ['subtest2a', 'subtest2b'] => '"sub test value2"' } }, + 'subtest2' => '"sub test value2"' } }, :match => [ ' allow test value 3;', ' test1 test value 1;', @@ -264,8 +259,7 @@ ' test2 test value 2b;', ' test4 subtest1 "sub test value1a";', ' test4 subtest1 "sub test value1b";', - ' test4 subtest2a "sub test value2";', - ' test4 subtest2b "sub test value2";', + ' test4 subtest2 "sub test value2";', ], }, ].each do |param| @@ -298,7 +292,7 @@ :attr => 'location_cfg_prepend', :value => { 'test1' => ['test value 1a', 'test value 1b'], 'test2' => 'test value 2', 'allow' => 'test value 3', 'test4' => { 'subtest1' => ['"sub test value1a"', '"sub test value 1b"'], - ['subtest2a', 'subtest2b'] => '"sub test value2"' } }, + 'subtest2' => '"sub test value2"' } }, :match => [ ' allow test value 3;', ' test1 test value 1a;', @@ -306,8 +300,7 @@ ' test2 test value 2;', ' test4 subtest1 "sub test value1a";', ' test4 subtest1 "sub test value1b";', - ' test4 subtest2a "sub test value2";', - ' test4 subtest2b "sub test value2";', + ' test4 subtest2 "sub test value2";', ], }, { @@ -351,7 +344,7 @@ :attr => 'location_cfg_append', :value => { 'test1' => 'test value 1', 'test2' => ['test value 2a', 'test value 2b'], 'allow' => 'test value 3', 'test4' => { 'subtest1' => ['"sub test value1a"', '"sub test value 1b"'], - ['subtest2a', 'subtest2b'] => '"sub test value2"' } }, + 'subtest2' => '"sub test value2"' } }, :match => [ ' allow test value 3;', ' test1 test value 1;', @@ -359,8 +352,7 @@ ' test2 test value 2b;', ' test4 subtest1 "sub test value1a";', ' test4 subtest1 "sub test value1b";', - ' test4 subtest2a "sub test value2";', - ' test4 subtest2b "sub test value2";', + ' test4 subtest2 "sub test value2";', ], }, ].each do |param| @@ -405,7 +397,7 @@ :attr => 'location_cfg_prepend', :value => { 'test1' => 'test value 1', 'test2' => ['test value 2a', 'test value 2b'], 'allow' => 'test value 3', 'test4' => { 'subtest1' => ['"sub test value1a"', '"sub test value 1b"'], - ['subtest2a', 'subtest2b'] => '"sub test value2"' } }, + 'subtest2' => '"sub test value2"' } }, :match => [ ' allow test value 3;', ' test1 test value 1;', @@ -413,8 +405,7 @@ ' test2 test value 2b;', ' test4 subtest1 "sub test value1a";', ' test4 subtest1 "sub test value1b";', - ' test4 subtest2a "sub test value2";', - ' test4 subtest2b "sub test value2";', + ' test4 subtest2 "sub test value2";', ], }, { @@ -452,7 +443,7 @@ :attr => 'location_cfg_append', :value => { 'test1' => ['test value 1a', 'test value 1b'], 'test2' => 'test value 2', 'allow' => 'test value 3', 'test4' => { 'subtest1' => ['"sub test value1a"', '"sub test value 1b"'], - ['subtest2a', 'subtest2b'] => '"sub test value2"' } }, + 'subtest2' => '"sub test value2"' } }, :match => [ ' allow test value 3;', ' test1 test value 1a;', @@ -460,8 +451,7 @@ ' test2 test value 2;', ' test4 subtest1 "sub test value1a";', ' test4 subtest1 "sub test value1b";', - ' test4 subtest2a "sub test value2";', - ' test4 subtest2b "sub test value2";', + ' test4 subtest2 "sub test value2";', ], }, { @@ -514,7 +504,7 @@ :attr => 'location_custom_cfg', :value => { 'test1' => ['test value 1a', 'test value 1b'], 'test2' => 'test value 2', 'allow' => 'test value 3', 'test4' => { 'subtest1' => ['"sub test value1a"', '"sub test value 1b"'], - ['subtest2a', 'subtest2b'] => '"sub test value2"' } }, + 'subtest2' => '"sub test value2"' } }, :match => [ ' allow test value 3;', ' test1 test value 1a;', @@ -522,8 +512,7 @@ ' test2 test value 2;', ' test4 subtest1 "sub test value1a";', ' test4 subtest1 "sub test value1b";', - ' test4 subtest2a "sub test value2";', - ' test4 subtest2b "sub test value2";', + ' test4 subtest2 "sub test value2";', ], }, ].each do |param| diff --git a/templates/vhost/vhost_footer.erb b/templates/vhost/vhost_footer.erb index 9558c9058..b4a4d7eb6 100644 --- a/templates/vhost/vhost_footer.erb +++ b/templates/vhost/vhost_footer.erb @@ -6,14 +6,12 @@ include <%= file %>; <%# sorted so that the ordering is stable. -%> <% if @vhost_cfg_append -%><% @vhost_cfg_append.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%> <% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end -%> + <%= key %> <%= subkey %> <%= asubvalue %>; <% end -%> <% end -%><% else -%> -<% Array(value).each do |sub| -%> - <%= key %> <%= sub %>; +<% Array(value).each do |asubvalue| -%> + <%= key %> <%= asubvalue %>; <% end -%> <% end -%> <% end -%><% end -%> diff --git a/templates/vhost/vhost_header.erb b/templates/vhost/vhost_header.erb index 40429e220..8fd7615ae 100644 --- a/templates/vhost/vhost_header.erb +++ b/templates/vhost/vhost_header.erb @@ -19,14 +19,12 @@ server { <%# sorted so that the ordering is stable. -%> <% if @vhost_cfg_prepend -%><% @vhost_cfg_prepend.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%> <% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end -%> + <%= key %> <%= subkey %> <%= asubvalue %>; <% end -%> <% end -%><% else -%> -<% Array(value).each do |sub| -%> - <%= key %> <%= sub %>; +<% Array(value).each do |asubvalue| -%> + <%= key %> <%= asubvalue %>; <% end -%> <% end -%> <% end -%><% end -%> diff --git a/templates/vhost/vhost_location_alias.erb b/templates/vhost/vhost_location_alias.erb index 0b1b93f4c..ccd47f8df 100644 --- a/templates/vhost/vhost_location_alias.erb +++ b/templates/vhost/vhost_location_alias.erb @@ -1,56 +1,47 @@ location <%= @location %> { <% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |key,value| -%> <% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end -%> + <%= key %> <%= subkey %> <%= asubvalue %>; <% end -%> <% end -%><% else -%> -<% Array(value).each do |sub| -%> - <%= key %> <%= sub %>; +<% 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(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end -%> + <%= key %> <%= subkey %> <%= asubvalue %>; <% end -%> <% end -%><% else -%> -<% Array(value).each do |sub| -%> - <%= key %> <%= sub %>; +<% Array(value).each do |asubvalue| -%> + <%= key %> <%= asubvalue %>; <% end -%> <% end -%> <% end -%><% end -%> alias <%= @location_alias %>; <% 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(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end -%> + <%= key %> <%= subkey %> <%= asubvalue %>; <% end -%> <% end -%><% else -%> -<% Array(value).each do |sub| -%> - <%= key %> <%= sub %>; +<% 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(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end -%> + <%= key %> <%= subkey %> <%= asubvalue %>; <% end -%> <% end -%><% else -%> -<% Array(value).each do |sub| -%> - <%= key %> <%= sub %>; +<% 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 index 74fe306e8..1e9382c9e 100644 --- a/templates/vhost/vhost_location_directory.erb +++ b/templates/vhost/vhost_location_directory.erb @@ -10,14 +10,12 @@ <% 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(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end -%> + <%= key %> <%= subkey %> <%= asubvalue %>; <% end -%> <% end -%><% else -%> -<% Array(value).each do |sub| -%> - <%= key %> <%= sub %>; +<% Array(value).each do |asubvalue| -%> + <%= key %> <%= asubvalue %>; <% end -%> <% end -%> <% end -%><% end -%> @@ -44,27 +42,23 @@ <% 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(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end -%> + <%= key %> <%= subkey %> <%= asubvalue %>; <% end -%> <% end -%><% else -%> -<% Array(value).each do |sub| -%> - <%= key %> <%= sub %>; +<% 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(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end -%> + <%= key %> <%= subkey %> <%= asubvalue %>; <% end -%> <% end -%><% else -%> -<% Array(value).each do |sub| -%> - <%= key %> <%= sub %>; +<% 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 index a8223761b..10f0d3c6c 100644 --- a/templates/vhost/vhost_location_empty.erb +++ b/templates/vhost/vhost_location_empty.erb @@ -1,14 +1,12 @@ 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(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end -%> + <%= key %> <%= subkey %> <%= asubvalue %>; <% end -%> <% end -%><% else -%> -<% Array(value).each do |sub| -%> - <%= key %> <%= sub %>; +<% 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 index 9b56f0bcc..e93a91033 100644 --- a/templates/vhost/vhost_location_fastcgi.erb +++ b/templates/vhost/vhost_location_fastcgi.erb @@ -1,27 +1,23 @@ location <%= @location %> { <% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |key,value| -%> <% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end -%> + <%= key %> <%= subkey %> <%= asubvalue %>; <% end -%> <% end -%><% else -%> -<% Array(value).each do |sub| -%> - <%= key %> <%= sub %>; +<% 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(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end -%> + <%= key %> <%= subkey %> <%= asubvalue %>; <% end -%> <% end -%><% else -%> -<% Array(value).each do |sub| -%> - <%= key %> <%= sub %>; +<% Array(value).each do |asubvalue| -%> + <%= key %> <%= asubvalue %>; <% end -%> <% end -%> <% end -%><% end -%> @@ -41,30 +37,24 @@ <% 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(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end -%> + <%= key %> <%= subkey %> <%= asubvalue %>; <% end -%> <% end -%><% else -%> -<% Array(value).each do |sub| -%> - <%= key %> <%= sub %>; +<% 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(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end -%> + <%= key %> <%= subkey %> <%= asubvalue %>; <% end -%> <% end -%><% else -%> -<% Array(value).each do |sub| -%> - <%= key %> <%= sub %>; +<% 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 index 2b8588cac..2d611dc4b 100644 --- a/templates/vhost/vhost_location_proxy.erb +++ b/templates/vhost/vhost_location_proxy.erb @@ -7,27 +7,23 @@ <% 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(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end -%> + <%= key %> <%= subkey %> <%= asubvalue %>; <% end -%> <% end -%><% else -%> -<% Array(value).each do |sub| -%> - <%= key %> <%= sub %>; +<% Array(value).each do |asubvalue| -%> + <%= key %> <%= asubvalue %>; <% end -%> <% end -%> <% end -%><% end -%> -<% if @location_cfg_prepend -%><% @location_cfg_prepend.each do |key,value| -%> +<% 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(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end -%> + <%= key %> <%=subkey %> <%= asubvalue %>; <% end -%> <% end -%><% else -%> -<% Array(value).each do |sub| -%> - <%= key %> <%= sub %>; +<% Array(value).each do |asubvalue| -%> + <%= key %> <%= asubvalue %>; <% end -%> <% end -%> <% end -%><% end -%> @@ -48,30 +44,24 @@ <% 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(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end -%> + <%= key %> <%= subkey %> <%= asubvalue %>; <% end -%> <% end -%><% else -%> -<% Array(value).each do |sub| -%> - <%= key %> <%= sub %>; +<% 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(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end -%> + <%= key %> <%= subkey %> <%= asubvalue %>; <% end -%> <% end -%><% else -%> -<% Array(value).each do |sub| -%> - <%= key %> <%= sub %>; +<% 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 index 66d3a28f9..39d8e6818 100644 --- a/templates/vhost/vhost_location_stub_status.erb +++ b/templates/vhost/vhost_location_stub_status.erb @@ -1,57 +1,47 @@ location <%= @location %> { <% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |key,value| -%> <% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end -%> + <%= key %> <%= subkey %> <%= asubvalue %>; <% end -%> <% end -%><% else -%> -<% Array(value).each do |sub| -%> - <%= key %> <%= sub %>; +<% 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(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end -%> + <%= key %> <%= subkey %> <%= asubvalue %>; <% end -%> <% end -%><% else -%> -<% Array(value).each do |sub| -%> - <%= key %> <%= sub %>; +<% 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(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end -%> + <%= key %> <%= subkey %> <%= asubvalue %>; <% end -%> <% end -%><% else -%> -<% Array(value).each do |sub| -%> - <%= key %> <%= sub %>; +<% 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(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end -%> + <%= key %> <%= subkey %> <%= asubvalue %>; <% end -%> <% end -%><% else -%> -<% Array(value).each do |sub| -%> - <%= key %> <%= sub %>; +<% Array(value).each do |asubvalue| -%> + <%= key %> <%= asubvalue %>; <% end -%> <% end -%> <% end -%><% end -%> - } - diff --git a/templates/vhost/vhost_ssl_footer.erb b/templates/vhost/vhost_ssl_footer.erb index a8b2f91aa..86419a232 100644 --- a/templates/vhost/vhost_ssl_footer.erb +++ b/templates/vhost/vhost_ssl_footer.erb @@ -3,27 +3,23 @@ include <%= file %>; <% end -%><% end -%> <% if @vhost_cfg_append -%><% @vhost_cfg_append.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%> <% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end -%> + <%= key %> <%= subkey %> <%= asubvalue %>; <% end -%> <% end -%><% else -%> -<% Array(value).each do |sub| -%> - <%= key %> <%= sub %>; +<% Array(value).each do |asubvalue| -%> + <%= key %> <%= asubvalue %>; <% end -%> <% end -%> <% end -%><% end -%> <% if @vhost_cfg_ssl_append -%><% @vhost_cfg_ssl_append.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%> <% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end -%> + <%= key %> <%= subkey %> <%= asubvalue %>; <% end -%> <% end -%><% else -%> -<% Array(value).each do |sub| -%> - <%= key %> <%= sub %>; +<% Array(value).each do |asubvalue| -%> + <%= key %> <%= asubvalue %>; <% end -%> <% end -%> <% end -%><% end -%> diff --git a/templates/vhost/vhost_ssl_header.erb b/templates/vhost/vhost_ssl_header.erb index 61129a008..e165b7123 100644 --- a/templates/vhost/vhost_ssl_header.erb +++ b/templates/vhost/vhost_ssl_header.erb @@ -50,27 +50,23 @@ server { <% if @vhost_cfg_prepend -%><% @vhost_cfg_prepend.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%> <% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end -%> + <%= key %> <%= subkey %> <%= asubvalue %>; <% end -%> <% end -%><% else -%> -<% Array(value).each do |sub| -%> - <%= key %> <%= sub %>; +<% Array(value).each do |asubvalue| -%> + <%= key %> <%= asubvalue %>; <% end -%> <% end -%> <% end -%><% end -%> <% if @vhost_cfg_ssl_prepend -%><% @vhost_cfg_ssl_prepend.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%> <% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%> -<% Array(subkey).each do |asubkey| -%> <% Array(subvalue).each do |asubvalue| -%> - <%= key %> <%= asubkey %> <%= asubvalue %>; -<% end -%> + <%= key %> <%= subkey %> <%= asubvalue %>; <% end -%> <% end -%><% else -%> -<% Array(value).each do |sub| -%> - <%= key %> <%= sub %>; +<% Array(value).each do |asubvalue| -%> + <%= key %> <%= asubvalue %>; <% end -%> <% end -%> <% end -%><% end -%>