On Nov 29, 2009, at 11:11 PM, Jesse Wolfe wrote:

> Replace this message that looks like an error
>  debug: Format s not supported for Puppet::FileServing::Metadata;  
> has not implemented method 'from_s'
> with
>  debug: file_metadata supports formats: b64_zlib_yaml marshal pson  
> raw yaml; using pson
>
> Signed-off-by: Jesse Wolfe <[email protected]>
> ---
> lib/puppet/network/format.rb         |    3 ---
> lib/puppet/network/format_handler.rb |    8 ++++++--
> 2 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/lib/puppet/network/format.rb b/lib/puppet/network/ 
> format.rb
> index a5be3af..c437639 100644
> --- a/lib/puppet/network/format.rb
> +++ b/lib/puppet/network/format.rb
> @@ -109,15 +109,12 @@ class Puppet::Network::Format
>
>         if type == :class
>             has_method = klass.respond_to?(method)
> -            message = "has not implemented method '%s'" % method
>         else
>             has_method = klass.instance_methods.include?(method)
> -            message = "has not implemented instance method  '%s'" %  
> method
>         end
>
>         return true if has_method
>
> -        Puppet.debug "Format %s not supported for %s; %s" %  
> [self.name, klass, message]
>         return false

This logical structure becomes obsolete with the rest of your patch,  
so it would be better as something like:

return true if type == :class and klass.respond_to?(method)
return true if klass.instance_methods.include?(method)
return false

I don't quite know whether that's the correct idiom - I've heard  
others say they prefer ' if ... and ... and return true'.  I'd follow  
Markus's guidance there.

Otherwise +1.

>     end
> end
> diff --git a/lib/puppet/network/format_handler.rb b/lib/puppet/ 
> network/format_handler.rb
> index e508a02..544ba82 100644
> --- a/lib/puppet/network/format_handler.rb
> +++ b/lib/puppet/network/format_handler.rb
> @@ -119,7 +119,11 @@ module Puppet::Network::FormatHandler
>                 format_handler.format(b).weight <=>  
> format_handler.format(a).weight
>             end
>
> -            put_preferred_format_first(result)
> +            result = put_preferred_format_first(result)
> +
> +            Puppet.debug "#{indirection.name} supports formats:  
> #{result.sort.join(' ')}; using #{result.first}"
> +
> +            result
>         end
>
>         private
> @@ -130,7 +134,7 @@ module Puppet::Network::FormatHandler
>                 list.delete(preferred_format)
>                 list.unshift(preferred_format)
>             else
> -                Puppet.warning "Value of  
> 'preferred_serialization_format' ('#{preferred_format}') is invalid,  
> using default ('#{list.first}')"
> +                Puppet.warning "Value of  
> 'preferred_serialization_format' (#{preferred_format}) is invalid  
> for #{indirection.name}, using default (#{list.first})"
>             end
>             list
>         end
> -- 
> 1.6.3.3
>
> --
>
> 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 
> .
>
>


-- 
The easiest way to figure the cost of living is to take your income and
add ten percent.
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com

--

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.


Reply via email to