Jira (PUP-1755) Inconsistent hash order with Ruby 1.8

2014-09-30 Thread Matthew Kennedy (JIRA)
Title: Message Title










 

 Matthew Kennedy commented on an issue


















  Re: Inconsistent hash order with Ruby 1.8 










If at all possible, I'd like to see if this might be re-examined. This causes a break in impotency in our environment and leads to services (notably apache/passenger) being restarted when there was no change in the underlying data. 
For example we are using the official puppetdb module and in the class `puppetdb::master::routes` the routes parameter is a hash and exhibits this issue. This is one example in many. One very annoying things is if I restart apache it will randomly /solve/ the issue and become idempotent.
Thanks in advance.












   

 Add Comment

























 Puppet /  PUP-1755



  Inconsistent hash order with Ruby 1.8 







 Hash table ordering in Puppet 3.x with Ruby 1.8 is inconsistent. It is known that Ruby 1.8 does not guarantee that hash tables are ordered by insertion order, like 1.9 does. However, whatever ordering Ruby 1.8 uses for a given hash table, it stays consistent, and is always the same whenever you iterate through it.   This is not true in Puppet 3.x used wi...















 This message was sent by Atlassian JIRA (v6.1.4#6159-sha1:44eaede)




 






  

Jira (PUP-1755) Inconsistent hash order with Ruby 1.8

2014-09-30 Thread Felix Frank (JIRA)
Title: Message Title










 

 Felix Frank commented on an issue


















  Re: Inconsistent hash order with Ruby 1.8 










I still believe that this warrants a ticket against the puppetdb module. If the templates therein expect hash arguments to be ordered, that is unclean implementation.












   

 Add Comment

























 Puppet /  PUP-1755



  Inconsistent hash order with Ruby 1.8 







 Hash table ordering in Puppet 3.x with Ruby 1.8 is inconsistent. It is known that Ruby 1.8 does not guarantee that hash tables are ordered by insertion order, like 1.9 does. However, whatever ordering Ruby 1.8 uses for a given hash table, it stays consistent, and is always the same whenever you iterate through it.   This is not true in Puppet 3.x used wi...















 This message was sent by Atlassian JIRA (v6.1.4#6159-sha1:44eaede)




 














-- 
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-1755) Inconsistent hash order with Ruby 1.8

2014-02-24 Thread Andre Nathan (JIRA)
Title: Message Title










 

 Andre Nathan created an issue


















 Puppet /  PUP-1755



  Inconsistent hash order with Ruby 1.8 










Issue Type:

  Bug




Affects Versions:


 3.x




Assignee:

 Andrew Parker




Components:


 DSL




Created:


 24/Feb/14 3:39 AM




Environment:


Ruby 1.8.7




Priority:

  Normal




Reporter:

 Andre Nathan










Hash table ordering in Puppet 3.x with Ruby 1.8 is inconsistent. It is known that Ruby 1.8 does not guarantee that hash tables are ordered by insertion order, like 1.9 does. However, whatever ordering Ruby 1.8 uses for a given hash table, it stays consistent, and is always the same whenever you iterate through it.
This is not true in Puppet 3.x used with Ruby 1.8, while it used to work with no problems in 2.7.x. The following code reproduces the issue:
$h =  { 'foo' = 1, 'bar' = 2, 'baz' = 3, }
$t = inline_template( %- for k, v in scope.lookupvar('h') -% %= \# {k}
 = # {v}
\ % %- end -% ) warning($t)
On different runs 

Jira (PUP-1755) Inconsistent hash order with Ruby 1.8

2014-02-24 Thread Andre Nathan (JIRA)
Title: Message Title










 

 Andre Nathan updated an issue


















 Puppet /  PUP-1755



  Inconsistent hash order with Ruby 1.8 










Change By:

 Andre Nathan









 HashtableorderinginPuppet3.xwithRuby1.8isinconsistent.ItisknownthatRuby1.8doesnotguaranteethathashtablesareorderedbyinsertionorder,like1.9does.However,whateverorderingRuby1.8usesforagivenhashtable,itstaysconsistent,andisalwaysthesamewheneveryouiteratethroughit.ThisisnottrueinPuppet3.xusedwithRuby1.8,whileitusedtoworkwithnoproblemsin2.7.x.Thefollowingcodereproducestheissue: {code} $h={'foo'=1,'bar'=2,'baz'=3,}$t=inline_template(%-fork,vinscope.lookupvar('h')-%%=\#{k}=#{v}\%%-end-%)warning($t) {code}   Ondifferentrunsofthecodeabove,theorderingwillbedifferent.Thismakesitimpossibletousehashiterationinatemplate,becausetheresultingfilewillkeepbeingchangedduetoordering.












   

 Add Comment






















 This message was sent by Atlassian JIRA (v6.1.4#6159-sha1:44eaede)




 














-- 
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/groups/opt_out.


Jira (PUP-1755) Inconsistent hash order with Ruby 1.8

2014-02-24 Thread Felix Frank (JIRA)
Title: Message Title










 

 Felix Frank commented on an issue


















  Re: Inconsistent hash order with Ruby 1.8 










Well, not quite impossible, albeit somewhat less convenient. As has been noted on the users' list, you can (and probably should) always use Hash#sort to get a stable representation of your data.
I'm not sure if Puppet should endorse templates that rely on undocumented behavior (i.e., predictable ordering of hash tables with equal contents), but I feel that we should not.












   

 Add Comment

























 Puppet /  PUP-1755



  Inconsistent hash order with Ruby 1.8 







 Hash table ordering in Puppet 3.x with Ruby 1.8 is inconsistent. It is known that Ruby 1.8 does not guarantee that hash tables are ordered by insertion order, like 1.9 does. However, whatever ordering Ruby 1.8 uses for a given hash table, it stays consistent, and is always the same whenever you iterate through it.   This is not true in Puppet 3.x used wi...















 This message was sent by Atlassian JIRA (v6.1.4#6159-sha1:44eaede)




 














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

Jira (PUP-1755) Inconsistent hash order with Ruby 1.8

2014-02-24 Thread Andre Nathan (JIRA)
Title: Message Title










 

 Andre Nathan commented on an issue


















  Re: Inconsistent hash order with Ruby 1.8 










Well, I may not be documented, but the behavior can surely be inferred from use. Or is this undocumented behavior of Puppet? Shouldn't I assume that a Puppet hash table ordering is consistent even when using Ruby 1.9? If the old behavior of 2.7.x can't be restored, shouldn't Puppet at least use an OrderedHash implementation for consistency? It's a bit weird that a language (the Puppet DSL) behaves differently depending on its implementation language (Ruby) version.












   

 Add Comment

























 Puppet /  PUP-1755



  Inconsistent hash order with Ruby 1.8 







 Hash table ordering in Puppet 3.x with Ruby 1.8 is inconsistent. It is known that Ruby 1.8 does not guarantee that hash tables are ordered by insertion order, like 1.9 does. However, whatever ordering Ruby 1.8 uses for a given hash table, it stays consistent, and is always the same whenever you iterate through it.   This is not true in Puppet 3.x used wi...















 This message was sent by Atlassian JIRA (v6.1.4#6159-sha1:44eaede)




 














-- 
You received this message because you are subscribed to the Google Groups Puppet Bugs group.
To unsubscribe from 

Jira (PUP-1755) Inconsistent hash order with Ruby 1.8

2014-02-24 Thread Felix Frank (JIRA)
Title: Message Title










 

 Felix Frank commented on an issue


















  Re: Inconsistent hash order with Ruby 1.8 










That is an interesting point, but pertains to the future parser only, I believe, because the Puppet DSL as seen before 3.5 has no hash (or array) iteration devices.
The ERB templates are Ruby code that is handed data structures from the DSL. It's a valid question whether those should be in the form of ordered hashes, but again, as long as such semantics are not documented, they should probably not be expected.
I'm torn on the question whether this would be an improvement. Requiring users to order their hashes themselves in templates seems a bit draconic, I guess...?












   

 Add Comment

























 Puppet /  PUP-1755



  Inconsistent hash order with Ruby 1.8 







 Hash table ordering in Puppet 3.x with Ruby 1.8 is inconsistent. It is known that Ruby 1.8 does not guarantee that hash tables are ordered by insertion order, like 1.9 does. However, whatever ordering Ruby 1.8 uses for a given hash table, it stays consistent, and is always the same whenever you iterate through it.   This is not true in Puppet 3.x used wi...















 This message was sent by Atlassian JIRA (v6.1.4#6159-sha1:44eaede)




 





Jira (PUP-1755) Inconsistent hash order with Ruby 1.8

2014-02-24 Thread Andre Nathan (JIRA)
Title: Message Title










 

 Andre Nathan commented on an issue


















  Re: Inconsistent hash order with Ruby 1.8 










There's also the issue that it forces logic (the sort/sort_by call) to be added to templates. Despite being a simple addition, I believe it's not ideal.












   

 Add Comment

























 Puppet /  PUP-1755



  Inconsistent hash order with Ruby 1.8 







 Hash table ordering in Puppet 3.x with Ruby 1.8 is inconsistent. It is known that Ruby 1.8 does not guarantee that hash tables are ordered by insertion order, like 1.9 does. However, whatever ordering Ruby 1.8 uses for a given hash table, it stays consistent, and is always the same whenever you iterate through it.   This is not true in Puppet 3.x used wi...















 This message was sent by Atlassian JIRA (v6.1.4#6159-sha1:44eaede)




 














-- 
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/groups/opt_out.


Jira (PUP-1755) Inconsistent hash order with Ruby 1.8

2014-02-24 Thread Henrik Lindberg (JIRA)
Title: Message Title










 

 Henrik Lindberg commented on an issue


















  Re: Inconsistent hash order with Ruby 1.8 










Ruby 1.8.x hashes are not guaranteed to be in any particular order. From Ruby 1.9 the order is based on the insert order. It is not good practice to rely on the order of elements in a hash. The order will remain documented as unspecified.












   

 Add Comment

























 Puppet /  PUP-1755



  Inconsistent hash order with Ruby 1.8 







 Hash table ordering in Puppet 3.x with Ruby 1.8 is inconsistent. It is known that Ruby 1.8 does not guarantee that hash tables are ordered by insertion order, like 1.9 does. However, whatever ordering Ruby 1.8 uses for a given hash table, it stays consistent, and is always the same whenever you iterate through it.   This is not true in Puppet 3.x used wi...















 This message was sent by Atlassian JIRA (v6.1.4#6159-sha1:44eaede)




 














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

Jira (PUP-1755) Inconsistent hash order with Ruby 1.8

2014-02-24 Thread Andre Nathan (JIRA)
Title: Message Title










 

 Andre Nathan commented on an issue


















  Re: Inconsistent hash order with Ruby 1.8 










I'm sorry but did you read the bug description? I'm not relying on a specific order of elements of a hash table. I'm trying to rely on the fact that it should be consistent once defined, as is the case of Ruby 1.8.
Can you please make clear what is unspecified? Is it hash ordering in puppet 3 with ruby 1.8? Can I rely on it if I'm using ruby 1.9, or is hash ordering in puppet unspecified independent of ruby version?












   

 Add Comment

























 Puppet /  PUP-1755



  Inconsistent hash order with Ruby 1.8 







 Hash table ordering in Puppet 3.x with Ruby 1.8 is inconsistent. It is known that Ruby 1.8 does not guarantee that hash tables are ordered by insertion order, like 1.9 does. However, whatever ordering Ruby 1.8 uses for a given hash table, it stays consistent, and is always the same whenever you iterate through it.   This is not true in Puppet 3.x used wi...















 This message was sent by Atlassian JIRA (v6.1.4#6159-sha1:44eaede)




 














-- 
You received this message because you are subscribed to the Google Groups Puppet Bugs group.
To unsubscribe from this 

Re: Jira (PUP-1755) Inconsistent hash order with Ruby 1.8

2014-02-24 Thread Trevor Vaughan
I'm not sure how you've been seeing consistency with Ruby 1.8 at any level.
I certainly have not and always do a 'sort' on my hash keys before using
them in a template.

Whenever Passenger restarts a PM, you'll potentially get a different order
in your hashes with 1.8 so I have to agree with Henrik here.

Trevor


On Mon, Feb 24, 2014 at 12:25 PM, Andre Nathan (JIRA) 
issue-upda...@puppetlabs.com wrote:

   Andre 
 Nathanhttps://tickets.puppetlabs.com/secure/ViewProfile.jspa?name=andrenth
 *commented* on an issueRe: Inconsistent hash order with Ruby
 1.8 https://tickets.puppetlabs.com/browse/PUP-1755

 I'm sorry but did you read the bug description? I'm not relying on a
 specific order of elements of a hash table. I'm trying to rely on the fact
 that it should be consistent once defined, as is the case of Ruby 1.8.

 Can you please make clear what is unspecified? Is it hash ordering in
 puppet 3 with ruby 1.8? Can I rely on it if I'm using ruby 1.9, or is hash
 ordering in puppet unspecified independent of ruby version?
[image: Add Comment]
 https://tickets.puppetlabs.com/browse/PUP-1755#add-comment  Add 
 Commenthttps://tickets.puppetlabs.com/browse/PUP-1755#add-comment
   Puppet https://tickets.puppetlabs.com/browse/PUP / [image: 
 Bug]https://tickets.puppetlabs.com/browse/PUP-1755
 PUP-1755 https://tickets.puppetlabs.com/browse/PUP-1755   Inconsistent
 hash order with Ruby 1.8 https://tickets.puppetlabs.com/browse/PUP-1755
   Hash table ordering in Puppet 3.x with Ruby 1.8 is inconsistent. It is
 known that Ruby 1.8 does not guarantee that hash tables are ordered by
 insertion order, like 1.9 does. However, whatever ordering Ruby 1.8 uses
 for a given hash table, it stays consistent, and is always the same
 whenever you iterate through it.

 This is not true in Puppet 3.x used wi...
   This message was sent by Atlassian JIRA (v6.1.4#6159-sha1:44eaede)   
 [image:
 Atlassian logo]

 --
 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/groups/opt_out.




-- 
Trevor Vaughan
Vice President, Onyx Point, Inc
(410) 541-6699
tvaug...@onyxpoint.com

-- This account not approved for unencrypted proprietary information --

-- 
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/groups/opt_out.


Jira (PUP-1755) Inconsistent hash order with Ruby 1.8

2014-02-24 Thread Henrik Lindberg (JIRA)
Title: Message Title










 

 Henrik Lindberg commented on an issue


















  Re: Inconsistent hash order with Ruby 1.8 










A hash does not have a specified order. In Ruby 1.9 elements are in the order they were added. If you want to process elements in a hash in a specific order, you have to arrange this by sorting by key, or looking up the keys in the order you want them. 
There will never be any guarantees about the order of elements in a hash from the Puppet Language perspective.












   

 Add Comment

























 Puppet /  PUP-1755



  Inconsistent hash order with Ruby 1.8 







 Hash table ordering in Puppet 3.x with Ruby 1.8 is inconsistent. It is known that Ruby 1.8 does not guarantee that hash tables are ordered by insertion order, like 1.9 does. However, whatever ordering Ruby 1.8 uses for a given hash table, it stays consistent, and is always the same whenever you iterate through it.   This is not true in Puppet 3.x used wi...















 This message was sent by Atlassian JIRA (v6.1.4#6159-sha1:44eaede)




 














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