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/puppet/network | |
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/puppet/network')
-rw-r--r-- | lib/puppet/network/format_handler.rb | 15 |
1 files changed, 14 insertions, 1 deletions
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 |