diff options
author | Luke Kanies <luke@madstop.com> | 2009-04-16 19:18:31 -0500 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-04-22 16:07:06 +1000 |
commit | f04a938084e0a68884af95378a3a9f81227c578f (patch) | |
tree | a82d78b7c25ed7c0c215caee0a0cc79c7bbb883f /lib | |
parent | 6a51f6fb2184f25bf45a1328e0ba889aa066ffd3 (diff) | |
download | puppet-f04a938084e0a68884af95378a3a9f81227c578f.tar.gz puppet-f04a938084e0a68884af95378a3a9f81227c578f.tar.xz puppet-f04a938084e0a68884af95378a3a9f81227c578f.zip |
Adding support for specifying a preferred serialization format
This isn't that great, but at least it provides
basic tuning of the format.
Also removing the catalog_format default, since it's
no longer used.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/defaults.rb | 8 | ||||
-rw-r--r-- | lib/puppet/network/format_handler.rb | 15 |
2 files changed, 19 insertions, 4 deletions
diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index a1af82f8e..f21fbc26a 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -485,9 +485,11 @@ module Puppet authority requests. It's a separate server because it cannot and does not need to horizontally scale."], :ca_port => ["$masterport", "The port to use for the certificate authority."], - :catalog_format => ["yaml", "What format to use to dump the catalog. Only supports - 'marshal' and 'yaml'. Only matters on the client, since it asks the server - for a specific format."], + :preferred_serialization_format => ["yaml", "The preferred means of serializing + ruby instances for passing over the wire. This won't guarantee that all + instances will be serialized using this method, since not all classes + can be guaranteed to support this format, but it will be used for all + classes that support it."], :puppetdlockfile => [ "$statedir/puppetdlock", "A lock file to temporarily stop puppetd from doing anything."], :usecacheonfailure => [true, diff --git a/lib/puppet/network/format_handler.rb b/lib/puppet/network/format_handler.rb index efeea79e3..e03432858 100644 --- a/lib/puppet/network/format_handler.rb +++ b/lib/puppet/network/format_handler.rb @@ -96,10 +96,23 @@ module Puppet::Network::FormatHandler end def supported_formats - format_handler.formats.collect { |f| format_handler.format(f) }.find_all { |f| f.supported?(self) }.collect { |f| f.name }.sort do |a, b| + result = format_handler.formats.collect { |f| format_handler.format(f) }.find_all { |f| f.supported?(self) }.collect { |f| f.name }.sort do |a, b| # It's an inverse sort -- higher weight formats go first. format_handler.format(b).weight <=> format_handler.format(a).weight end + + put_preferred_format_first(result) + end + + private + + def put_preferred_format_first(list) + preferred_format = Puppet.settings[:preferred_serialization_format].to_sym + if list.include?(preferred_format) + list.delete(preferred_format) + list.unshift(preferred_format) + end + list end end |