Skip to content

Commit

Permalink
Merge pull request #58 from awegmann/master
Browse files Browse the repository at this point in the history
Changed ini template to sort the key
  • Loading branch information
bfraser committed Oct 26, 2015
2 parents 09cc58e + e0e6981 commit 99a92e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
7 changes: 4 additions & 3 deletions spec/classes/grafana_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,10 @@
expected = "# This file is managed by Puppet, any changes will be overwritten\n\n"\
"app_mode = production\n\n"\
"[section]\n"\
"string = production\n"\
"number = 8080\n"\
"boolean = false\n"\
"empty = \n"
"empty = \n"\
"number = 8080\n"\
"string = production\n"

it { should contain_file('/etc/grafana/grafana.ini').with_content(expected) }

Expand Down Expand Up @@ -306,3 +306,4 @@
end
end
end

10 changes: 5 additions & 5 deletions templates/config.ini.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# This file is managed by Puppet, any changes will be overwritten

<%- @cfg.each_pair do |key, value|
if value.is_a?(Hash) -%>
<%- @cfg.keys.sort.each do |key|
if @cfg[key].is_a?(Hash) -%>

[<%= key %>]
<%- value.each_pair do |key, value| -%>
<%= key %> = <%= value %>
<%- @cfg[key].keys.sort.each do |valkey| -%>
<%= valkey %> = <%= @cfg[key][valkey] %>
<%- end -%>
<%- else -%>
<%= key %> = <%= value %>
<%= key %> = <%= @cfg[key] %>
<%- end
end -%>

0 comments on commit 99a92e3

Please sign in to comment.