ruby1.9.1 and String.each
k9ert opened this issue · 1 comments
I'm a bit confused about puppi and ruby1.9.1. It seems that this version of ruby is missing the each-method for strings:
$ ruby1.9.1
"test".each {|car| print car }
-:1:in <main>': undefined method
each' for "test":String (NoMethodError)
Puppi is leveraging that on some places, e.g manifests/logs.pp
puppi::log { 'mail':
description => 'Mail messages',
log => '/var/log/mail.log',
}
later on, in the templates it uses e.g. templates/log.erb:
<% log.each do |path| %><%= path %>
<% end %>
These places can be fixed just by changing it to an one-element-array in the above pp.
However there seems to be places where this is not possible:
Failed to parse template puppi/info/module.erb:
Filepath: /tmp/vagrant-puppet/modules-0/puppi/templates/info/module.erb
Line: 24
Detail: undefined method `each' for "/etc/puppi/puppi.conf":String
at /tmp/vagrant-puppet/modules-0/puppi/manifests/info/module.pp:55 on ....
Line 24 in module.erb:
echo_title "$HOSTNAME - <%= name %>: Configuration Files managed: <% configfile.each do |item| %><%= item %><% end %>"
The definition of $configfile is in manifests/infos.pp (Line 59):
configfile => "${puppi::params::basedir}/puppi.conf",
How can this be addressed? Can we fix it the same way? I can provide a pull-request if wanted?! Do i miss something here?
Well, I think the whole puppi module needs a good relifting and should start to really use the puppi::ze integration of the new modules.
For the moment if you have fixes please test and push them.
maybe this could be enough fot the last case:
configfile => [ "${puppi::params::basedir}/puppi.conf" ] ,