Sans
2011-Dec-07 15:26 UTC
[Puppet Users] what is "private method `split'' called for nil:NilClass" error??
Dear all, I have this line: <% $c_repo.split('','').each_with_index do |repo, i| %> in one of my template files and on the target node I''m getting this error: err: Could not retrieve catalog from remote server: Error 400 on SERVER: Failed to parse template zmfs/zmfs_prob.erb: private method `split'' called for nil:NilClass Any idea what am I missing? Cheers!! -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Felix Frank
2011-Dec-07 15:33 UTC
Re: [Puppet Users] what is "private method `split'' called for nil:NilClass" error??
Hi, On 12/07/2011 04:26 PM, Sans wrote:> Dear all, > > I have this line: > > <% $c_repo.split('','').each_with_index do |repo, i| %> > > in one of my template files and on the target node I''m getting this > error: > > err: Could not retrieve catalog from remote server: Error 400 on > SERVER: Failed to parse template zmfs/zmfs_prob.erb: private method > `split'' called for nil:NilClass > > > Any idea what am I missing? Cheers!!I shall assume that you declare a variable $c_repo somewhere in your manifest. In your template, reference it as ''c_repo'' without the leading dollar sign: <% c_repo.split('','').each_with_index do |repo, i| %> HTH, Felix -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Sans
2011-Dec-07 18:17 UTC
[Puppet Users] Re: what is "private method `split'' called for nil:NilClass" error??
thanks Felix! that''s it - good catch. did not notice the "$" sign at all. working just fine now. Cheers, San On Dec 7, 3:33 pm, Felix Frank <felix.fr...@alumni.tu-berlin.de> wrote:> > > I shall assume that you declare a variable $c_repo somewhere in your > manifest. > > In your template, reference it as ''c_repo'' without the leading dollar sign: > > <% c_repo.split('','').each_with_index do |repo, i| %> > > HTH, > Felix-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Daniel Pittman
2011-Dec-08 00:13 UTC
Re: [Puppet Users] Re: what is "private method `split'' called for nil:NilClass" error??
...and to close that loop: in Ruby, ''$c_repo'' is a global variable. Because nothing will ever have assigned it, you called the `split` method on the default value, `nil`, which raised that error. Puppet then reported it. :) Daniel On Wed, Dec 7, 2011 at 10:17, Sans <r.santanu.das@gmail.com> wrote:> thanks Felix! that''s it - good catch. did not notice the "$" sign at > all. working just fine now. > > Cheers, > San > > On Dec 7, 3:33 pm, Felix Frank <felix.fr...@alumni.tu-berlin.de> > wrote: >> >> >> I shall assume that you declare a variable $c_repo somewhere in your >> manifest. >> >> In your template, reference it as ''c_repo'' without the leading dollar sign: >> >> <% c_repo.split('','').each_with_index do |repo, i| %> >> >> HTH, >> Felix > > -- > You received this message because you are subscribed to the Google Groups "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. >-- ⎋ Puppet Labs Developer – http://puppetlabs.com ♲ Made with 100 percent post-consumer electrons -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Sans
2011-Dec-08 09:17 UTC
[Puppet Users] Re: what is "private method `split'' called for nil:NilClass" error??
Hi Daniel, Thanks for the explanation. It''s always good to know the underlaying cause. Cheers!! On Dec 8, 12:13 am, Daniel Pittman <dan...@puppetlabs.com> wrote:> ...and to close that loop: in Ruby, ''$c_repo'' is a global variable. > Because nothing will ever have assigned it, you called the `split` > method on the default value, `nil`, which raised that error. Puppet > then reported it. :) > > Daniel-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Seemingly Similar Threads
- Could not retrieve local facts: private method `split' called for nil:NilClass
- Bug: NoMethodError: private method `gsub'' called for nil:NilClass
- Error 400 on SERVER: private method `gsub' called for nil:NilClass
- undefined method `each'' for nil:NilClass with Ferret search
- Could not intern from yaml: undefined method `intern' for nil:NilClass