X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/ff044920428608b2c04507ad52d6ab52c9d6555f..0d881c7262ed69a06591d7b29f4f9e370e100a8d:/cookbooks/munin/libraries/expand.rb diff --git a/cookbooks/munin/libraries/expand.rb b/cookbooks/munin/libraries/expand.rb index 081dfc5c1..4dadd14d3 100644 --- a/cookbooks/munin/libraries/expand.rb +++ b/cookbooks/munin/libraries/expand.rb @@ -2,10 +2,10 @@ 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] } else - template.gsub("%%", node) + template.gsub("%%%", node.tr("-", "_")).gsub("%%", node) end end.join(" ") end