Igor Berger
2013-Dec-17 16:23 UTC
[Puppet Users] Geppetto complains about uninitialized variables in reduce function
Hello, I''m using the following expression to format a list: $valid_environments = [''env1'', ''env2'', ''env3''] $env_message = $valid_environments.reduce |$message, $env| { "${message}, ${env}" } It works at run-time (Puppet 3.2.4 standalone with "--parser=future"). However in Eclipse (v4.3.1), Geppetto (v4.0) shows these errors: Reference to not yet initialized variable: env'' Reference to not yet initialized variable: message'' The workspace Puppet target version is set to "future". Is there another syntax I could use to make Geppetto happy or is this a bug? Thanks, Igor. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/eb6d78c8-0223-496a-8aec-640c546e5559%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Henrik Lindberg
2013-Dec-18 00:13 UTC
Re: [Puppet Users] Geppetto complains about uninitialized variables in reduce function
On 2013-17-12 17:23, Igor Berger wrote:> Hello, > > I''m using the following expression to format a list: > > $valid_environments = [''env1'', ''env2'', ''env3''] > $env_message = $valid_environments.reduce |$message, $env| { > "${message}, ${env}" } > > It works at run-time (Puppet 3.2.4 standalone with "--parser=future"). > > However in Eclipse (v4.3.1), Geppetto (v4.0) shows these errors: > > Reference to not yet initialized variable: env'' > Reference to not yet initialized variable: message'' > > The workspace Puppet target version is set to "future". > > Is there another syntax I could use to make Geppetto happy or is this a bug? >That looks like a bug. Please report it here: https://tickets.puppetlabs.com/browse/GEP The errors are for the case when there are parameters to a class or define and the default value expression references one of the other variables - i.e. something like this define foo($a = $b, $b = 3) { } So, something is amiss with the validation for a lambda. I assume you have turned on the "future" under Puppet Target. Regards - henrik -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/l8qpag%24kql%241%40ger.gmane.org. For more options, visit https://groups.google.com/groups/opt_out.