Issue #16268 has been updated by Henrik Lindberg. Status changed from Needs More Information to Needs Decision
This still fails in 3.0.0. There is no error If the example is modified to use a list instead of an array (tested with 3.0.0). IMO. this is a bug that should be fixed. ---------------------------------------- Bug #16268: Hash literals not allowed inside conditional block https://projects.puppetlabs.com/issues/16268#change-72859 Author: Jochen Schalanda Status: Needs Decision Priority: Normal Assignee: eric sorenson Category: language Target version: Affected Puppet version: Keywords: dsl Branch: The Puppet DSL currently doesn’t allow hash literals expressions being used as the value in a conditional block. Using a temporary variable which holds the value works, though. Non-working example: $test = undef ? { undef => { 'test' => 'success' }, default => 'foo', } notice($test) Result with Puppet 2.7.19: $ puppet apply conditional_hash.pp Could not parse for environment production: Syntax error at '{'; expected '}' at /tmp/conditional_hash.pp:2 on node localhost Working example: $my_hash = { 'test' => 'success' } $test = undef ? { undef => $my_hash, default => 'foo', } notice($test) Result: $ puppet apply conditional_hash2.pp notice: Scope(Class[main]): {"test"=>"success"} notice: Finished catalog run in 0.03 seconds -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
