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

.empty? throwing exception on nil value #55

Open
samjaninf opened this issue Aug 7, 2015 · 1 comment
Open

.empty? throwing exception on nil value #55

samjaninf opened this issue Aug 7, 2015 · 1 comment

Comments

@samjaninf
Copy link

In certain places in your files particularly in my case the host.pp and host/data.pp you have this:

'array' => inline_template("<%= (ips+[]).uniq.delete_if {|x| x.empty? }.join(',') %>"),

When I run that I get an error from puppet:

Error 400 on SERVER: Failed to parse inline template: undefined method `empty?‘ for :undef:Symbol

I believe it is because it is getting thrown a Nil value. I changed them to:

'array' => inline_template("<%= (ips+[]).uniq.delete_if {|x| x.nil? }.join(',') %>"),

and it seemed to work fine after that.

@purpleidea
Copy link
Owner

I don't recommend this change, because it empty values aren't seen by nil. Eg:

 => false 

I would accept a patch for an empty||nil test, however I think you should root cause why you're seeing nil's. I think that's the issue, likely in your setup somewhere...

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