# /etc/mcollective/policies/<%= @agent -%>.policy
<% if( @default ) then -%>
policy default <%= @default %>
<% end -%>
<% @rules.each do |comment, rule| -%>
# <%= comment %>
<%= rule['policy'] %>	<%= rule['caller'] %>	<%= rule['actions'] %>	<%= rule['facts'] %>	<%= rule['classes'] %>
<% end -%>

# /etc/mcollective/policies/<%= @agent -%>.policy
<% if( @default ) then -%>
policy default <%= @default %>
<% end -%>
<% @rules.sort.map do |comment, rule| -%>
# <%= comment %>
<%= rule['policy'] %>	<%= rule['caller'] %>	<%= rule['actions'] %>	<%= rule['facts'] %>	<%= rule['classes'] %>
<% end -%>

Sort the rules on output to ensure proper ordering.
Sort the rules on output to ensure proper ordering.
