projects
/
chef.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Mark parent directories for git repositories as safe
[chef.git]
/
cookbooks
/
munin
/
libraries
/
expand.rb
diff --git
a/cookbooks/munin/libraries/expand.rb
b/cookbooks/munin/libraries/expand.rb
index dcd73cb69d77afb8b5dbbab1cf152a90992952b9..248c5ad5f07e4986dd9ff1e8100a8c05311b884d 100644
(file)
--- a/
cookbooks/munin/libraries/expand.rb
+++ b/
cookbooks/munin/libraries/expand.rb
@@
-1,13
+1,17
@@
class Chef
class Munin
class Chef
class Munin
- def self.expand(template, nodes)
+ def self.expand(template, nodes
, separator = " "
)
nodes.map do |node|
if node.is_a?(Hash)
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
else
- template.gsub("%%", node)
+ template
+ .gsub("%%%", node.tr("-", "_"))
+ .gsub("%%", node)
end
end
- end.join(
" "
)
+ end.join(
separator
)
end
end
end
end
end
end