Issue #15910 has been updated by James Turnbull.

Project changed from Puppet DSL to Puppet
Category deleted (Puppet DSL)


----------------------------------------
Bug #15910: Arithmetic expressions not allowed inside conditional block
https://projects.puppetlabs.com/issues/15910#change-69374

Author: Jochen Schalanda
Status: Unreviewed
Priority: Normal
Assignee: Pieter van de Bruggen
Category: 
Target version: 
Affected Puppet version: 
Keywords: 
Branch: 


The Puppet DSL currently doesn't allow arithmetic expressions being used as the 
value in a conditional block. Using a temporary variable which holds the value 
or using @inline_template@ works but isn't very elegant.

Example:
<pre>
$number = 1
$test = undef ? {
  undef   => 2*$number,
  default => 'foo',
}

notice($test)
</pre>

Actual result with Puppet 2.7.17:
<pre>
$ puppet apply conditional_arithmetic.pp                                        
                                                                                
 
Could not parse for environment production: Syntax error at '*'; expected '}' 
at /tmp/conditional_arithmetic.pp:4 on node localhost
</pre>

Expected result:
<pre>
$ puppet apply conditional_arithmetic.pp  
notice: Scope(Class[main]): 2
notice: Finished catalog run in 0.03 seconds
</pre>


-- 
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.

Reply via email to