Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

template varaible array issue #7

Closed
gitkent opened this issue Dec 10, 2013 · 6 comments
Closed

template varaible array issue #7

gitkent opened this issue Dec 10, 2013 · 6 comments

Comments

@gitkent
Copy link

gitkent commented Dec 10, 2013

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
Copy link
Owner

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
Copy link
Author

gitkent commented Dec 10, 2013

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
Copy link
Owner

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

@gitkent
Copy link
Author

gitkent commented Dec 13, 2013

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
Copy link
Owner

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
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants