Much better; +1

On Sep 30, 2009, at 11:58 AM, Nigel Kersten wrote:

>
>
> Signed-off-by: Nigel Kersten <[email protected]>
> ---
> .../provider/macauthorization/macauthorization.rb  |   24 +++++++++ 
> +----------
> 1 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/lib/puppet/provider/macauthorization/ 
> macauthorization.rb b/lib/puppet/provider/macauthorization/ 
> macauthorization.rb
> index b53529c..d1e2b22 100644
> --- a/lib/puppet/provider/macauthorization/macauthorization.rb
> +++ b/lib/puppet/provider/macauthorization/macauthorization.rb
> @@ -226,11 +226,18 @@  
> Puppet 
> ::Type.type(:macauthorization).provide :macauthorization, :parent =>  
> Puppe
>         # This mainly converts the keys from the puppet attributes  
> to the
>         # 'native' ones, but also enforces that the keys are all  
> Strings
>         # rather than Symbols so that any merges of the resultant  
> Hash are
> -        # sane.
> +        # sane. The exception is booleans, where we coerce to a  
> proper bool
> +        # if they come in as a symbol.
>         newplist = {}
>         propertylist.each_pair do |key, value|
>             next if key == :ensure     # not part of the auth db  
> schema.
>             next if key == :auth_type  # not part of the auth db  
> schema.
> +            case value
> +            when true, :true
> +                value = true
> +            when false, :false
> +                value = false
> +            end
>             new_key = key
>             if PuppetToNativeAttributeMap.has_key?(key)
>                 new_key = PuppetToNativeAttributeMap[key].to_s
> @@ -243,7 +250,7 @@  
> Puppet 
> ::Type.type(:macauthorization).provide :macauthorization, :parent =>  
> Puppe
>     end
>
>     def retrieve_value(resource_name, attribute)
> -
> +        # We set boolean values to symbols when retrieving values
>         if not self.class.parsed_auth_db.has_key?(resource_name)
>             raise Puppet::Error.new("Cannot find #{resource_name} in  
> auth db")
>         end
> @@ -257,9 +264,9 @@  
> Puppet 
> ::Type.type(:macauthorization).provide :macauthorization, :parent =>  
> Puppe
>         if self.class.parsed_auth_db[resource_name].has_key? 
> (native_attribute)
>             value = self.class.parsed_auth_db[resource_name] 
> [native_attribute]
>             case value
> -            when true, "true", :true
> +            when true, :true
>                 value = :true
> -            when false, "false", :false
> +            when false, :false
>                 value = :false
>             end
>
> @@ -287,14 +294,7 @@  
> Puppet 
> ::Type.type(:macauthorization).provide :macauthorization, :parent =>  
> Puppe
>         end
>
>         define_method(field.to_s + "=") do |value|
> -            case value
> -            when true, "true", :true
> -                @property_hash[field] = :true
> -            when false, "false", :false
> -                @property_hash[field] = :false
> -            else
> -                @property_hash[field] = value
> -            end
> +            @property_hash[field] = value
>         end
>     end
>
> -- 
> 1.6.4.2
>
>
> >


-- 
It's not to control, but to protect the citizens of Singapore. In our
society, you can state your views, but they have to be correct.
     -- Ernie Hai, co-ordinator of the Singapore Government
     Internet Project
---------------------------------------------------------------------
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