Clean up warning messages so that they don't fail when run inside the test class.
Signed-off-by: Jesse Wolfe <[email protected]> --- lib/puppet/network/format_handler.rb | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/puppet/network/format_handler.rb b/lib/puppet/network/format_handler.rb index 544ba82..ea8cf35 100644 --- a/lib/puppet/network/format_handler.rb +++ b/lib/puppet/network/format_handler.rb @@ -121,20 +121,28 @@ module Puppet::Network::FormatHandler result = put_preferred_format_first(result) - Puppet.debug "#{indirection.name} supports formats: #{result.sort.join(' ')}; using #{result.first}" + Puppet.debug "#{friendly_name} supports formats: #{result.map{ |f| f.to_s }.sort.join(' ')}; using #{result.first}" result end private + def friendly_name + if self.respond_to? :indirection + indirection.name + else + self + end + end + 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) else - Puppet.warning "Value of 'preferred_serialization_format' (#{preferred_format}) is invalid for #{indirection.name}, using default (#{list.first})" + Puppet.warning "Value of 'preferred_serialization_format' (#{preferred_format}) is invalid for #{friendly_name}, using default (#{list.first})" end list end -- 1.6.5 -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
