X-Git-Url: https://git.openstreetmap.org/chef.git/blobdiff_plain/805ab61e66fe3adb45e57f50e49b168d84a6a8b1..7b9ec4b60ee39614d1d083d7220e76b07d2b275f:/cookbooks/munin/libraries/expand.rb diff --git a/cookbooks/munin/libraries/expand.rb b/cookbooks/munin/libraries/expand.rb new file mode 100644 index 000000000..9269761f9 --- /dev/null +++ b/cookbooks/munin/libraries/expand.rb @@ -0,0 +1,13 @@ +class Chef + class Munin + def self.expand(template, nodes) + nodes.map do |node| + if node.kind_of?(Hash) + template.gsub(/%%([^%]+)%%/) { node[$1.to_sym] } + else + template.gsub("%%", node) + end + end.join(" ") + end + end +end