[Puppet Users] Re: hiera_array() default value not taken
we end up doing this a lot: $var = hiera_hash('key','SOMESTRING') if is_hash($var) { } not the most elegant On Friday, April 6, 2012 11:52:58 AM UTC-5, psychobyte wrote: I don't think hiera likes defaults as array/hashes explicitly I usually do a $empty_hsh = {} $empty_arr = [] and use those as default values. HTH On Monday, April 2, 2012 5:03:37 AM UTC-7, pablo.f...@cscs.ch wrote: Hi, There is probably something stupid I am missing, but I just can't see it. I do: $iptables_open_ports_public = hiera_array ('iptables_open_ports_public', []) And I have not defined that in the hiera tree, so the default (an empty array) should be returned. But I get, instead: Error 400 on SERVER: Could not find data item iptables_open_ports_public in any Hiera data file and no default supplied Is there any special way to define an empty array as a parameter? Thanks! Pablo -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/Ikyx3E7QWogJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: hiera_array() default value not taken
I have this problem too. Do defaults work for anyone? On Apr 2, 7:03 am, Pablo Fernandez pablo.fernan...@cscs.ch wrote: Hi, There is probably something stupid I am missing, but I just can't see it. I do: $iptables_open_ports_public = hiera_array ('iptables_open_ports_public', []) And I have not defined that in the hiera tree, so the default (an empty array) should be returned. But I get, instead: Error 400 on SERVER: Could not find data item iptables_open_ports_public in any Hiera data file and no default supplied Is there any special way to define an empty array as a parameter? Thanks! Pablo -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: hiera_array() default value not taken
I'm using the YAML backend. Not sure if that's going to matter. On Apr 6, 11:07 am, Jason Koppe jason.robert.ko...@gmail.com wrote: I have this problem too. Do defaults work for anyone? On Apr 2, 7:03 am, Pablo Fernandez pablo.fernan...@cscs.ch wrote: Hi, There is probably something stupid I am missing, but I just can't see it. I do: $iptables_open_ports_public = hiera_array ('iptables_open_ports_public', []) And I have not defined that in the hiera tree, so the default (an empty array) should be returned. But I get, instead: Error 400 on SERVER: Could not find data item iptables_open_ports_public in any Hiera data file and no default supplied Is there any special way to define an empty array as a parameter? Thanks! Pablo -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: hiera_array() default value not taken
Looks like a default of [] triggers https://github.com/puppetlabs/hiera-puppet/blob/master/lib/puppet/parser/functions/hiera_array.rb#L32 to think that the `.lookup` function did not get an answer. Hiera and Hiera-puppet have to distinguish between empty/false/nil answers sent by the backend due to missing data, or empty/false/nil answers explicitly returned as the default value or found value. Having hiera just return an empty answer when an answer is not found would probably not be preferable, so nil could possibly be the not found value? -Hunter On Monday, April 2, 2012 5:03:37 AM UTC-7, pablo.f...@cscs.ch wrote: Hi, There is probably something stupid I am missing, but I just can't see it. I do: $iptables_open_ports_public = hiera_array ('iptables_open_ports_public', []) And I have not defined that in the hiera tree, so the default (an empty array) should be returned. But I get, instead: Error 400 on SERVER: Could not find data item iptables_open_ports_public in any Hiera data file and no default supplied Is there any special way to define an empty array as a parameter? Thanks! Pablo -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/qiLhtq9pEX8J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: hiera_array() default value not taken
I don't think hiera likes defaults as array/hashes explicitly I usually do a $empty_hsh = {} $empty_arr = [] and use those as default values. HTH On Monday, April 2, 2012 5:03:37 AM UTC-7, pablo.f...@cscs.ch wrote: Hi, There is probably something stupid I am missing, but I just can't see it. I do: $iptables_open_ports_public = hiera_array ('iptables_open_ports_public', []) And I have not defined that in the hiera tree, so the default (an empty array) should be returned. But I get, instead: Error 400 on SERVER: Could not find data item iptables_open_ports_public in any Hiera data file and no default supplied Is there any special way to define an empty array as a parameter? Thanks! Pablo -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/r9CJ90mbMVgJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.