From df4243491e70e88b357b95fb000a7b429954d145 Mon Sep 17 00:00:00 2001 From: Joshua Hoblitt Date: Fri, 16 Aug 2013 16:29:05 -0700 Subject: [PATCH] sort $vhost_cfg_append hash in vhost_footer.erb template This is so the paremter ordering in the configuration is stable. It also force the :allow key (if it exists) to be first in the sort ordering. It would probably be better to change `$vhost_cfg_append` into an array of one key hashes but would require a public API change. --- templates/vhost/vhost_footer.erb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/templates/vhost/vhost_footer.erb b/templates/vhost/vhost_footer.erb index 904c2e8b6..0f70a7de7 100644 --- a/templates/vhost/vhost_footer.erb +++ b/templates/vhost/vhost_footer.erb @@ -1,7 +1,10 @@ <% if @include_files %><% @include_files.each do |file| -%> include <%= file %>; <% end -%><% end -%> -<% if @vhost_cfg_append -%><% vhost_cfg_append.each do |key,value| -%> +<%# make sure that allow comes before deny by forcing the allow key (if it -%> +<%# exists) to be first in the output order. The hash keys also need to be -%> +<%# 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| -%> <%= key %> <%= value %>; <% end -%> <% end -%>