Jira (PUP-4451) Allow automatic conversion of string to numeric for certain comparisons

2015-04-22 Thread Henrik Lindberg (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Henrik Lindberg commented on  PUP-4451 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
  Re: Allow automatic conversion of string to numeric for certain comparisons  
 
 
 
 
 
 
 
 
 
 
As you say, the way forward is to use facter with --stringified_facts turned off on the agent (afaik, you do not need cfacter for this). This gives you correct data types instead of a vague mush of data in string form. 
Meanwhile( and instead of using scanf) you can also write: 
 
 
 
 
 
 
if 0 + $::operatingsysemmajrelease = 7
 
 
 
 
 
 
 
to force conversion to a number. 
We are not going to open the can of worms that automatic string to number conversion would mean. (Sorry). 
 
 
 
 
 
 
 
 
 
 
 
 

 
 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-4451) Allow automatic conversion of string to numeric for certain comparisons

2015-04-22 Thread Alex Jurkiewicz (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Alex Jurkiewicz commented on  PUP-4451 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
  Re: Allow automatic conversion of string to numeric for certain comparisons  
 
 
 
 
 
 
 
 
 
 
Just to clarify, stringified_facts is gone in Puppet 4 – it's always on. I'll open another ticket to change the data type this fact returns. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 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-4451) Allow automatic conversion of string to numeric for certain comparisons

2015-04-22 Thread Henrik Lindberg (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Henrik Lindberg commented on  PUP-4451 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
  Re: Allow automatic conversion of string to numeric for certain comparisons  
 
 
 
 
 
 
 
 
 
 
Changing the data type is a breaking change. A solution is to add a new fact, maybe even a structure where the data types are of a more useful data type. Note though that there is nothing saying that all operating systems universally will have a numeric value for this fact, so there may be the need to supply it both in string form, and as a number if possible, and it is the user's choice to use one or the other. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 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-4451) Allow automatic conversion of string to numeric for certain comparisons

2015-04-22 Thread Josh Cooper (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Josh Cooper updated an issue 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
 Puppet /  PUP-4451 
 
 
 
  Allow automatic conversion of string to numeric for certain comparisons  
 
 
 
 
 
 
 
 
 

Change By:
 
 Josh Cooper 
 
 
 

Scrum Team:
 
 Language 
 
 
 
 
 
 
 
 
 
 
 
 

 
 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-4451) Allow automatic conversion of string to numeric for certain comparisons

2015-04-21 Thread Alex Jurkiewicz (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Alex Jurkiewicz updated an issue 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
 Puppet /  PUP-4451 
 
 
 
  Allow automatic conversion of string to numeric for certain comparisons  
 
 
 
 
 
 
 
 
 

Change By:
 
 Alex Jurkiewicz 
 
 
 
 
 
 
 
 
 
 Thefollowingcodeworkswith3.7and`--parserfuture`butnot4.0.0:{code}if$::operatingsystemmajrelease=7{{code}Theerroris:{code}EvaluationError:Comparisonof:String=Integer,isnotpossible.Causedby'AStringisnotcomparabletoanonString'.{code}Thisappearstobeadeliberatedecision:https://github.com/puppetlabs/puppet-specifications/blob/master/language/types_values_variables.md#string-to-numeric-conversionAutomaticconversionbetweenStringandNumericisperformedforarithmeticoperations,butnotforcomparisons.Thismeanssuchcodehastobewrittenas:{code}ifscanf($::operatingsystemmajrelease,%i) [0] =7{{code}Ofcoursethisspecificexampleisfixedwithcfactor,butIthinkthereareplentyofothercaseswhere this similar behaviouris desired required .I'dliketorequestreconsiderationofincludingautomatictypecastingforoperators,atleastincaseslike= whereI'dimagineyouonlywanttosupportuseonnumerictypes . Explicitconversionisnotpretty. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 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-4451) Allow automatic conversion of string to numeric for certain comparisons

2015-04-21 Thread Alex Jurkiewicz (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Alex Jurkiewicz created an issue 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
 Puppet /  PUP-4451 
 
 
 
  Allow automatic conversion of string to numeric for certain comparisons  
 
 
 
 
 
 
 
 
 

Issue Type:
 
  Bug 
 
 
 

Affects Versions:
 

 PUP 4.0.0 
 
 
 

Assignee:
 

 Unassigned 
 
 
 

Components:
 

 Language 
 
 
 

Created:
 

 2015/04/21 7:09 PM 
 
 
 

Environment:
 
 
Puppet 4.0.0 
 
 
 

Priority:
 
  Normal 
 
 
 

Reporter:
 
 Alex Jurkiewicz 
 
 
 
 
 
 
 
 
 
 
The following code works with 3.7 and `--parser future` but not 4.0.0: 
 
 
 
 
 
 
if $::operatingsystemmajrelease = 7 { 
 
 
 
  

Jira (PUP-4451) Allow automatic conversion of string to numeric for certain comparisons

2015-04-21 Thread Alex Jurkiewicz (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Alex Jurkiewicz updated an issue 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
 Puppet /  PUP-4451 
 
 
 
  Allow automatic conversion of string to numeric for certain comparisons  
 
 
 
 
 
 
 
 
 

Change By:
 
 Alex Jurkiewicz 
 
 
 

Issue Type:
 
 Bug Improvement 
 
 
 
 
 
 
 
 
 
 
 
 

 
 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-4451) Allow automatic conversion of string to numeric for certain comparisons

2015-04-21 Thread Alex Jurkiewicz (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Alex Jurkiewicz updated an issue 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
 Puppet /  PUP-4451 
 
 
 
  Allow automatic conversion of string to numeric for certain comparisons  
 
 
 
 
 
 
 
 
 

Change By:
 
 Alex Jurkiewicz 
 
 
 
 
 
 
 
 
 
 Thefollowingcodeworkswith3.7and`--parserfuture`butnot4.0.0:{code}if$::operatingsystemmajrelease=7{{code}Theerroris:{code}EvaluationError:Comparisonof:String=Integer,isnotpossible.Causedby'AStringisnotcomparabletoanonString'.{code}Thisappearstobeadeliberatedecision:https://github.com/puppetlabs/puppet-specifications/blob/master/language/types_values_variables.md#string-to-numeric-conversionAutomaticconversionbetweenStringandNumericisperformedforarithmeticoperations,butnotforcomparisons.Thismeanssuchcodehastobewrittenas:{code}ifscanf($::operatingsystemmajrelease ,%i )=7{{code}Ofcoursethisspecificexampleisfixedwithcfactor,butIthinkthereareplentyofothercaseswherethisbehaviourisdesired.I'dliketorequestreconsiderationofincludingautomatictypecastingforoperators,atleastincaseslike=whereI'dimagineyouonlywanttosupportuseonnumerictypes. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 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.