]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/munin/libraries/expand.rb
Remove bit of config which might have been causing everything to be blocked.
[chef.git] / cookbooks / munin / libraries / expand.rb
index 081dfc5c12299a2bd8ee7544b97e765059363794..f9c447387b2d0dadbcb558dfb208d53d81a6e270 100644 (file)
@@ -2,10 +2,14 @@ class Chef
   class Munin
     def self.expand(template, nodes)
       nodes.map do |node|
-        if node.kind_of?(Hash)
-          template.gsub(/%%([^%]+)%%/) { node[$1.to_sym] }
+        if node.is_a?(Hash)
+          template
+            .gsub(/%%%([^%]+)%%%/) { node[Regexp.last_match[1].to_sym].tr("-", "_") }
+            .gsub(/%%([^%]+)%%/) { node[Regexp.last_match[1].to_sym] }
         else
-          template.gsub("%%", node)
+          template
+            .gsub("%%%", node.tr("-", "_"))
+            .gsub("%%", node)
         end
       end.join(" ")
     end