On Nov 21, 2008, at 10:52 AM, Nigel Kersten wrote:

>
> I was trying to track down why a manifest that looks like this for  
> my type:
>
> macauthorization {"system.device.dvd.setregion.initial":
>  ensure => present,
>  shared => true,
> }
>
> kept telling me:
>
> notice: //Macauthorization[system.device.dvd.setregion.initial]/ 
> shared:
> shared changed 'true' to 'true'
>
> and some debugging in the property class showed that the current value
> class is a TrueClass while the new value class is a Symbol.
>
> Should I need to do munging like this in the property definition, or
> is this an indication something else is up with my type? like I'm not
> symbolizing somewhere that I should be?
>
>    newproperty(:shared) do
>        desc "shared"
>        newvalue(:true)
>        newvalue(:false)
>
>        munge do |value|
>            case value
>            when true, "true", :true:
>                true
>            else
>                value
>            end
>        end
>    end
>
> The current value will always come out as a boolean from the backing  
> store.


I agree there's something ridiculous going on here, but you shouldn't  
need to manually munge things.

I'd start by adding debugging to your type to see where you've got the  
boolean and where you've got the symbol or whatever.

 From the code, only strings are converted to symbols by default, but  
I think a limitation in the system caused me to start using symbols  
everywhere, and there's some kind of magic that that makes true/false  
work.

For this, you might also try adding ':boolean => true' to the property  
declaration:

   newproperty(:shared, :boolean => true) do ... end

This should actually be autodetected, but it's convenient in that it  
gives you a 'resource.shared?' method, which can be useful.

The master branch has all of this newvalue code completely refactored,  
and it will be much easier to make it behave more sensibly.

-- 
Measure with a micrometer. Mark with chalk. Cut with an axe.
---------------------------------------------------------------------
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 puppet-dev@googlegroups.com
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