Skip to content
This repository has been archived by the owner on Nov 6, 2024. It is now read-only.

Commit

Permalink
Be more conservative with Chef attributes
Browse files Browse the repository at this point in the history
While '-' literals are valid in attribute keys, they are not valid with
'dot' notation.

Plug in icinga_format so that differences between Ruby and the Icinga
configuration language can be papered over comprehensively.

This is the only template I needed to touch for my use case, but there
are others that seem like they could use the same treatment.
  • Loading branch information
hfinucane committed Mar 24, 2016
1 parent 7a98bef commit 204aeef
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions templates/default/object.environment.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,19 @@ object Host <%= node_hash['fqdn'].inspect %> {
<% if var && value && value.is_a?(Hash) -%>
<% value.each do |a, v|-%>
<% if a && v && v.is_a?(Hash) && !v.empty?-%>
vars.<%= var -%><%= [a].inspect -%> = {
vars["<%= var -%>"][<%= a.inspect -%>] = {
<% v.each do |a1, v1|%>
<% if a1 && v1 %>
<%= a1 -%> = <%= v1.inspect %>
"<%= a1 -%>" = <%= icinga_format(v1) %>
<% end -%>
<% end -%>
}
<% else -%>
vars.<%= var -%><%= [a].inspect -%> = <%= v.inspect %>
vars["<%= var -%>"][<%= a.inspect -%>] = <%= icinga_format(v) %>
<% end -%>
<% end -%>
<% elsif var && value -%>
vars.<%= var -%> = <%= value.inspect %>
vars["<%= var -%>"] = <%= icinga_format(value) %>
<% end -%>
<% end -%>
<% end -%>
Expand Down

0 comments on commit 204aeef

Please sign in to comment.