Moonshine Ordered Hash
IMPORTANT: Moonshine Ordered Hash is no longer supported.
Some Moonshine users may have noticed unnecessary restarts of services or re-configuration of various resources.
Currently shadow_puppet uses Ruby 1.8's built-in Hash for resources. The downside to this is that Hash in Ruby 1.8 is inherently unordered. This can lead to scenarios where a Hash is "different" only because the ordering of keys differs. This behavior is undesirable as it can cause unnecessary restarts of services, etc.
Let's say you were doing something like this in your
:hosts: :127.0.0.1: localhost :126.96.36.199: dns
If you are generating a configuration file from this hash using a pattern like:
<% configuration[:hosts].each do |key, value| %> <%= key %> = <%= value %> <% end %>
This file may be regenerated even though the configuration hasn't changed. This is due to Ruby 1.8's Hashes being unordered, meaning that YAML stanzas loaded into a Hash may change ordering at random.
script/plugin install git://github.com/railsmachine/moonshine_ordered_hash.git --force
We understand that overriding the Hash class with the ActiveSupport::OrderedHash is pretty unorthodox, however in our testing we've yet to hit any problems with this change. You are safe to test this out in your existing deployments, however I strongly encourage doing a few deploys to staging before rolling it out to production, just to be extra safe.
Once we are confident that this change works the way we want, we will evaluate making it the default in shadow_puppet itself.
Unless otherwise specified, all content copyright © 2014, Rails Machine, LLC