Issue #1759 has been updated by jamtur01.

Status changed from Unreviewed to Accepted
Target version set to 0.24.7


----------------------------------------
Bug #1759: Numeric comparison does not work as expected in if statements
http://projects.reductivelabs.com/issues/show/1759

Author: tmz
Status: Accepted
Priority: Normal
Assigned to: masterzen
Category: language
Target version: 0.24.7
Complexity: Unknown
Affected version: 0.24.6
Keywords: 


Attempting to use the new if statements in 0.24.6, I found that numeric 
comparisons did not work as I would expect.  An example:

$operatingsystemrelease = 10 # From facter
if $operatingsystemrelease > 9 # This is not true.  Huh?

Thinking it might be comparing the facter variable as a string, try it 
hardcoded:

if 10 > 9 # Still not true.  Odd.

if 10 > 09 # This is true.

So, is the comparison being done character by character or is it just doing 
string comparison?  The examples in the documentation indicate that using 
numeric comparisons are intended to work (with examples like "if $ram > 1024" 
and "if ( $processor_count > 2 )" at 
http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#if-else).

fujin posted a handy demo at http://pastie.org/318391


----------------------------------------
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://reductivelabs.com/redmine/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