X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/157d98f404bf4fb5dcdf6752f807982aaf297261..47f47a50aa25f9b42e36703bcba0ce9f4dc4f87e:/cookbooks/munin/libraries/expand.rb diff --git a/cookbooks/munin/libraries/expand.rb b/cookbooks/munin/libraries/expand.rb index 4dadd14d3..f9c447387 100644 --- a/cookbooks/munin/libraries/expand.rb +++ b/cookbooks/munin/libraries/expand.rb @@ -3,9 +3,13 @@ class Chef def self.expand(template, nodes) nodes.map do |node| if node.is_a?(Hash) - template.gsub(/%%([^%]+)%%/) { node[Regexp.last_match[1].to_sym] } + template + .gsub(/%%%([^%]+)%%%/) { node[Regexp.last_match[1].to_sym].tr("-", "_") } + .gsub(/%%([^%]+)%%/) { node[Regexp.last_match[1].to_sym] } else - template.gsub("%%%", node.tr("-", "_")).gsub("%%", node) + template + .gsub("%%%", node.tr("-", "_")) + .gsub("%%", node) end end.join(" ") end