]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/munin/libraries/expand.rb
add function to create and delete tablespaces
[chef.git] / cookbooks / munin / libraries / expand.rb
index 4dadd14d38dfbc9f53c92ef4d933bd2a23eebeb5..f9c447387b2d0dadbcb558dfb208d53d81a6e270 100644 (file)
@@ -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