Skip to content

Commit

Permalink
Merge pull request redhat-openstack#32 from ChrisPortman/option_ordering
Browse files Browse the repository at this point in the history
Implement Consistent Option Ordering
  • Loading branch information
saz committed Apr 15, 2014
2 parents 1426c30 + 02037f0 commit dffda8a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions templates/sshd_config.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
# File is managed by Puppet
<%- options = scope.lookupvar('ssh::server::merged_options') -%>
<%- if port = options.delete('Port') -%>
Port <%= port %>
<%- end -%>
<%- if listen = options.delete('ListenAddress') -%>
ListenAddress <%= listen %>
<%- end -%>

<%- scope.lookupvar('ssh::server::merged_options').sort_by{ |sk| (sk.to_s.downcase.include? "match") ? sk.to_s : '' }.each do |k, v| -%>
<%- options.keys.sort_by{ |sk| (sk.to_s.downcase.include? "match") ? 'zzz' + sk.to_s : sk.to_s }.each do |k| -%>
<%- v = options[k] -%>
<%- if v.is_a?(Hash) -%>
<%= k %>
<%- v.sort.each do |key, value| -%>
<%- v.keys.sort.each do |key| -%>
<%- value = v[key] -%>
<%- if value.is_a?(Array) -%>
<%- value.each do |a| -%>
<%= key %> <%= a %>
Expand Down

0 comments on commit dffda8a

Please sign in to comment.