Jira (PUP-4282) numeric comparison error
Title: Message Title Henrik Lindberg updated an issue Puppet / PUP-4282 numeric comparison error Change By: Henrik Lindberg Test code: {code:puppet} { $num50 = 5.0 $x = $::memorysize_mb * 1000 if is_float($x) { notify{"x is a float":} } if is_float($num50) { notify{"num50 is a float":} } #if ( $::x >= $num50 )#{ notify{"<$x> greater or equal to <$num50>":} } #else#{ notify{"<$x> less than than <$num50>":} }} {code} Produces {code} Notice: x is a floatNotice: num50 is a float {code} OK.Uncomment the comparison lines and I get an error: {code} Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Comparison of: # >= Float, is not possible. Caused by 'Only Strings and Numbers are comparable'. {code} h2. QA Risk AnalysisN/A for unreproducible bugs Add Comment This message was sent by Atlassian JIRA (v6.3.15#6346-sha1:dbc023d) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-4282) numeric comparison error
Title: Message Title Kurt Wall updated an issue Puppet / PUP-4282 numeric comparison error Change By: Kurt Wall Test code:{ $num50 = 5.0 $x = $::memorysize_mb * 1000 if is_float($x) { notify{"x is a float":} } if is_float($num50) { notify{"num50 is a float":} } #if ( $::x >= $num50 )#{ notify{"<$x> greater or equal to <$num50>":} } #else#{ notify{"<$x> less than than <$num50>":} }}ProducesNotice: x is a floatNotice: num50 is a floatOK.Uncomment the comparison lines and I get an error:Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Comparison of: # >= Float, is not possible. Caused by 'Only Strings and Numbers are comparable'. h2. QA Risk AnalysisN/A for unreproducible bugs Add Comment This message was sent by Atlassian JIRA (v6.3.15#6346-sha1:dbc023d) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-4282) numeric comparison error
Title: Message Title Kurt Wall updated an issue Puppet / PUP-4282 numeric comparison error Change By: Kurt Wall QA Status: Reviewed Add Comment This message was sent by Atlassian JIRA (v6.3.15#6346-sha1:dbc023d) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-4282) numeric comparison error
Title: Message Title Kurt Wall updated an issue Puppet / PUP-4282 numeric comparison error Change By: Kurt Wall QA Contact: Kurt Wall Add Comment This message was sent by Atlassian JIRA (v6.3.15#6346-sha1:dbc023d) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-4282) numeric comparison error
Title: Message Title Henrik Lindberg commented on PUP-4282 Re: numeric comparison error Larry Orcutt I read your updated post more carefully - now it correctly tells you what is wrong - you are indeed comparing a String and a Float. The stdlib function is_float is lying! It reports true for a String that can be converted to a Float ! Note that future parser still converts strings to numbers when arithmetic is performed on the values. Do you have stringify facts on? (If so, all facts are strings) - turn of stringify facts to get proper data types (if you can). Do you need your manifests to be backwards compatible or not? If you do not care about backwards compatibility (or just for testing the example), use the type system to check types instead of the (o_O) stdlib functions. e.g. {{$value =~ Float }}. If you need to retain that facts are Strings (or if the fact in question is a numeric value in sting format), then you can most easily convert it to a number by adding 0 or 0.0 to it. Alternatively, you can use the scanf function to convert from string to value. The function assert_type is also convenient to catch type errors. Why you got the original error (the "label provider" instead of "String", in your error message is still unanswered, but I guess it is something that was wrong in your local file system since you now were able to get the correct error message. I am going to close this as a "won't fix" since I believe it works as intended. Feel free to ask more questions (or reopen if by using the type system instead of the is_float function you can show that the evaluator is indeed a comparison of two floats values). Add Comment This message was sent by Atlassian JIRA (v6.3.10#6340-sha1:7ea293a)
Jira (PUP-4282) numeric comparison error
Title: Message Title Henrik Lindberg commented on PUP-4282 Re: numeric comparison error Yes, there should be no auto convert for comparisons as decided in PUP-3615 . The problem reported in this ticket is two-fold, it appears that two float values are not comparable, and then the error message is corrupted because it is trying to tell us that one of the compared objects is the thing that produces the label for the object (label being "Float", "String", "An if _expression_", etc) instead of the actual label. Add Comment This message was sent by Atlassian JIRA (v6.3.10#6340-sha1:7ea293a) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-4282) numeric comparison error
Title: Message Title Paula Vaughan commented on PUP-4282 Re: numeric comparison error I've run the same sample code "foo.pp" on a box with puppet 3.7.2 and get the following results... Notice: Scope(Node[com]): <3833.70> less than <50> In this case, the comparison worked. (it may not look that way, but here, 50 is 50,000) Is this somewhat related to "( PUP-3615 ) Remove string to number auto convert for compare and equals"? When I look at the compare_operator code, it appears that the auto convert is occuring in the 3.7.2 code, but not in the 3.7.4 code. Add Comment This message was sent by Atlassian JIRA (v6.3.10#6340-sha1:7ea293a) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-4282) numeric comparison error
Title: Message Title Larry Orcutt commented on PUP-4282 Re: numeric comparison error I still seem to be seeing an issue as I go back to my original task. [root@hpg8-03 etc]# puppet apply /tmp/foo.pp --parser future --environment production Notice: Scope(Node[com]): memorysize_mb is a float <129022.95> Error: Evaluation Error: Comparison of: String >= Integer, is not possible. Caused by 'A String is not comparable to a non String'. at /tmp/foo.pp:3:25 on node hpg8-03.fsc.fedex.com Error: Evaluation Error: Comparison of: String >= Integer, is not possible. Caused by 'A String is not comparable to a non String'. at /tmp/foo.pp:3:25 on node hpg8-03.fsc.fedex.com [root@hpg8-03 etc]# cat /tmp/foo.pp node /\.com$/ { if is_float($::memorysize_mb) { notice "memorysize_mb is a float <$::memorysize_mb>" } if ( $::memorysize_mb >= 5 ) { notice "<$::memorysize_mb> greater or equal to <50>" } #else { notice "<$::memorysize_mb> less than <50>" } } [root@hpg8-03 etc]# Add Comment This message was sent by Atlassian JIRA (v6.3.10#6340-sha1:7ea293a) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-4282) numeric comparison error
Title: Message Title Henrik Lindberg commented on PUP-4282 Re: numeric comparison error To make sure you are actually running that version, you could change line 221 to start with "XXX Comparison of...", and verify that the XXX is part of the output. (Then change it back again). I will test against 3.7.4 as well (you may want to wait for that). Add Comment This message was sent by Atlassian JIRA (v6.3.10#6340-sha1:7ea293a) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-4282) numeric comparison error
Title: Message Title Larry Orcutt commented on PUP-4282 Re: numeric comparison error Please close. Appears to be a dumb error on my part unable to see the difference between $x and $::x. Sorry about that. Add Comment This message was sent by Atlassian JIRA (v6.3.10#6340-sha1:7ea293a) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-4282) numeric comparison error
Title: Message Title Larry Orcutt commented on PUP-4282 Re: numeric comparison error Sorry - just saw that I cut and pasted the wrong section from the file: 220 COMPARISON_NOT_POSSIBLE = hard_issue :COMPARISON_NOT_POSSIBLE, :operator, :left_value, :right_value, :detail do 221 "Comparison of: # {label(left_value)} # {operator} # {label(right_value)} , is not possible. Caused by '# {detail} '." 222 end Add Comment This message was sent by Atlassian JIRA (v6.3.10#6340-sha1:7ea293a) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-4282) numeric comparison error
Title: Message Title Larry Orcutt commented on PUP-4282 Re: numeric comparison error Looking at /usr/lib/ruby/site_ruby/1.8/puppet/pops/issues.rb on the puppet master: 228 MATCH_NOT_STRING = hard_issue :MATCH_NOT_STRING, :left_value do 229 "Left match operand must result in a String value. Got # {label.a_an(left_value)} ." 230 end [root@vmst13 ~]# rpm -qf /usr/lib/ruby/site_ruby/1.8/puppet/pops/issues.rb puppet-3.7.4-1.el6.noarch [root@vmst13 ~]# rpm -V puppet-3.7.4-1.el6.noarch S.5T. c /etc/puppet/auth.conf S.5T. c /etc/puppet/puppet.conf .M... /var/lib/puppet/state [root@vmst13 ~]# sum /usr/lib/ruby/site_ruby/1.8/puppet/pops/issues.rb 10312 23 [root@vmst13 ~]# The rpm information and the checksum on this file is the same on the client where I was seeing the error. Is there anything else you needed? Add Comment This message was sent by Atlassian JIRA (v6.3.10#6340-sha1:7ea293a) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-4282) numeric comparison error
Title: Message Title Henrik Lindberg commented on PUP-4282 Re: numeric comparison error Larry Orcutt can you look at the other things I suggested as I cannot reproduce the problem you are seeing. Add Comment This message was sent by Atlassian JIRA (v6.3.10#6340-sha1:7ea293a) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-4282) numeric comparison error
Title: Message Title Larry Orcutt commented on PUP-4282 Re: numeric comparison error Yes, this is using future parser. Add Comment This message was sent by Atlassian JIRA (v6.3.10#6340-sha1:7ea293a) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-4282) numeric comparison error
Title: Message Title Henrik Lindberg commented on PUP-4282 Re: numeric comparison error Please also check the content of the file lib/puppet/pops/issues.rb, the error in question looks like this on master: COMPARISON_NOT_POSSIBLE = hard_issue :COMPARISON_NOT_POSSIBLE, :operator, :left_value, :right_value, :detail do "Comparison of: #{label(left_value)} #{operator} #{label(right_value)}, is not possible. Caused by '#{detail}'." end and the reported problem would probably occur if the first interpolation has been tampered with to read something else. I cannot find any commits between the old way of reporting the error (which was): fail("Comparison of #{left.class} #{o.operator} #{right.class} is not possible. Caused by #{e.message}.", o, scope) and when a switch was made to use the new issue reporting system in commit f61cdde810eccd3a08a8206b7c6650713a9df5f0 and it is unchanged since then afaict. It is thus quite surprising. Please try on a fresh copy of puppet to ensure puppet source has not been tampered with. And if possible try this on 3.7.5 (stable branch at the moment, very soon to be released). Add Comment
Jira (PUP-4282) numeric comparison error
Title: Message Title Henrik Lindberg assigned an issue to Larry Orcutt Puppet / PUP-4282 numeric comparison error Change By: Henrik Lindberg Assignee: Larry Orcutt Add Comment This message was sent by Atlassian JIRA (v6.3.10#6340-sha1:7ea293a) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-4282) numeric comparison error
Title: Message Title Henrik Lindberg commented on PUP-4282 Re: numeric comparison error First, I assume that 'parser = future' or the ModelLabelProvider would never have been involved. Secondly, there seems to be something wrong with the error message production itself, it seems to output the label provider, not the value that is being compared. (Will look into that asap). I tried this on what will be 3.7.5 like this: $num50 = 5.0 $x = $::memorysize_mb * 1000 if $x =~ Float { notice "x is a float" } if $num50 =~ Float { notice "num50 is a float" } if $x >= $num50 { notice "<$x> is greater or equal to <$num50>"
Jira (PUP-4282) numeric comparison error
Title: Message Title Christopher Price updated an issue Puppet / PUP-4282 numeric comparison error Change By: Christopher Price Component/s: Puppet Server Component/s: Language Add Comment This message was sent by Atlassian JIRA (v6.3.10#6340-sha1:7ea293a) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-4282) numeric comparison error
Title: Message Title Christopher Price updated an issue Puppet / PUP-4282 numeric comparison error Change By: Christopher Price Scrum Team: Puppet Server Language Add Comment This message was sent by Atlassian JIRA (v6.3.10#6340-sha1:7ea293a) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-4282) numeric comparison error
Title: Message Title Christopher Price commented on PUP-4282 Re: numeric comparison error Henrik Lindberg any ideas? Add Comment This message was sent by Atlassian JIRA (v6.3.10#6340-sha1:7ea293a) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-4282) numeric comparison error
Title: Message Title Larry Orcutt created an issue Puppet / PUP-4282 numeric comparison error Issue Type: Bug Affects Versions: PUP 3.7.4 Assignee: Unassigned Components: Puppet Server Created: 2015/03/23 10:45 AM Environment: Linux RHEL/Centos 6 Priority: Normal Reporter: Larry Orcutt Test code: { $num50 = 5.0 $x = $::memorysize_mb * 1000 if is_float($x) { notify {"x is a float":} } if is_float($num50) { notify {"num50 is a float":} } #if ( $::x >= $num50 ) #{ notify {"<$x> greater or equal to <$num50>":} } #else #{ notify {"<$x> less than than <$num50>":} } } Produces Notice: x is a float Notice: num50 is a float OK. Uncomment the comparison lines and