jhoblitt / puppet-ganglia

Manages ganglia gmond & gmetad daemons + web front end
Other
12 stars 34 forks source link

template varaible array issue #7

Closed gitkent closed 10 years ago

gitkent commented 10 years ago

I've had issue on /etc/puppet/environments/production/modules/ganglia/templates/gmond.conf.el6.erb (el5 as well i guess) with error " Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Failed to parse template ganglia/gmond.conf.el6.erb: Filepath: /etc/puppet/environments/production/modules/ganglia/templates/gmond.conf.el6.erb Line: 36 Detail: undefined method `each' for nil:NilClass at /etc/puppet/environments/production/modules/ganglia/manifests/gmond/config.pp:25 on node rhel6test.datamail.co.nz Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run "

running on puppet agent 3.3. It looks like ruby doens't understand .each loopinh function in the template. I'd added the following to fix it.

<% if @udp_send_channel.is_a? Array ; @udp_send_channel.each do |channel| -%> ... ... ... ... <% end ; end -%>

jhoblitt commented 10 years ago

Nice catch. In theory, udp_send_channel should only be able to be an array or nil. Are you passing something like udp_send_channel => undef?

gitkent commented 10 years ago

no, I am passing the default item in the array. class ganglia::gmond ( ... ... $udp_send_channel = [ { mcast_join => '239.2.11.71', port => 8649, ttl => 1 } ], ... ... ) { ... ... }

jhoblitt commented 10 years ago

That's not valid syntax. Could you provide a real code snippet?

gitkent commented 10 years ago

sorry about delayed as I'd been rebuilding the machine. The code snippet as below is in gmond.pp:-

class ganglia::gmond ( $cluster_name = 'unspecified', $cluster_owner = 'unspecified', $cluster_latlong = 'unspecified', $cluster_url = 'unspecified', $host_location = 'unspecified', $gmond_mute = 'no', $gmond_deaf = 'yes', $udp_send_channel = [ { mcast_join => '239.2.11.71', port => 8649, ttl => 1 } ], $udp_recv_channel = [ { mcast_join => '239.2.11.71', port => 8649, bind => '239.2.11.71' } ], $tcp_accept_channel = [ { port => 8659 } ], ) { include ganglia::params validate_string($cluster_name) validate_string($cluster_owner) .... ... ... .... ... ...

jhoblitt commented 10 years ago

I apologize if my request was vague, what I was asking for a snippet from your manifest in which you are declaring the ganglia::gmond class.

jhoblitt commented 10 years ago

I believe PR #11 should prevent the Detail: undefined methodeach' for nil:NilClass` error that was being reported. I'm going to go ahead and close this issue but please reopen it if the problem is reproducible with the current master branch.