Skip to content

Commit 89a42a4

Browse files
author
Chris Portman
committed
Sort the Options Hash
Sort the options hash by downcased key. Any Match are forced to the end. This works by sorting the options keys as an array so that it should work in ruby 1.8.7
1 parent 86d9048 commit 89a42a4

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

templates/sshd_config.erb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@ Port <%= port %>
66
ListenAddress <%= listen %>
77
<%- end -%>
88

9-
<%- scope.lookupvar('ssh::server::merged_options').sort_by{ |sk| (sk.to_s.downcase.include? "match") ? sk.to_s : '' }.each do |k, v| -%>
9+
<%- options = scope.lookupvar('ssh::server::merged_options') -%>
10+
<%- options.keys.sort_by{ |sk| (sk.to_s.downcase.include? "match") ? 'zzz' + sk.to_s : sk.to_s }.each do |k| -%>
11+
<%- v = options[k] -%>
1012
<%- if v.is_a?(Hash) -%>
1113
<%= k %>
12-
<%- v.sort.each do |key, value| -%>
14+
<%- v.keys.sort.each do |key| -%>
15+
<%- value = v[key] -%>
1316
<%- if value.is_a?(Array) -%>
1417
<%- value.each do |a| -%>
1518
<%= key %> <%= a %>

0 commit comments

Comments
 (0)