On May 5, 2012, at 8:21 PM, Philip Brown wrote:

> 
> 
> On Saturday, May 5, 2012 7:42:43 PM UTC-7, Luke Kanies wrote:
> 
> Sorry - I meant it needs to be in the definition of the relevant property, 
> which in this case is 'ensure' (but in exec is 'returns').
> 
>  
> For those "following along at home", that apparently means that, rather than 
> the nice simple (but apparently, OVERLY simplified)
> single line of
> 
> "ensurable" 
> in a type definition, I now have to do:
> 
>     ensurable do
>       defaultvalues
>       
>       # This appears to be "change to state", for "ensurable"s.
>       def change_to_s(oldstate,newstate)
>         if ( oldstate == :absent && newstate == :present )
>           return "set #{@resource[:property]} = #{@resource[:value]}"
>         end
>       end
>     end 
> 
> This stuff may as well be black magic. it reaaally needs to be added to the 
> "how to write your own type" documentation!! :(
> It is not at all apparent, than a single line,
> "ensurable" is some short cut for an expandable "property definition"
> 
> Similarly for the "defaultvalues" line. not particular understandable, but  
> "it just has to be there".
> 
> (At least I have C++/java experience, so I can guess how it works. but for 
> someone else trying to learn how to write their own types, etc. .. yuck)

I largely agree - for the very simple cases of the very complex cases, it works 
well enough, but for anything in between it's a bit rough.

I think the RAL is in drastic need of refactoring, but it's a large job with a 
larger backward compatibility problem and isn't directly necessary to get 
anything else done, so it never quite gets prioritized like I'd like.

-- 
Luke Kanies | http://about.me/lak | http://puppetlabs.com/ | +1-615-594-8199

-- 
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