On May 5, 2012, at 3:52 PM, Philip Brown wrote:

> 
> 
> On Saturday, May 5, 2012 3:35:10 PM UTC-7, Philip Brown wrote:
> 
> 
> judging by all the xxx_to_s methods in the type directory though, there's 
> some interesting functionality here, that *really* needs to be documented :(
> 
> wow. yes, it reaaaaly does.
> I ran across it in maillist.rb, as
>       def change_to_s(current_value, newvalue)
>         return "Purged #{resource}" if newvalue == :purged
>         super
>       end
> 
> But that really didnt tell me much of what the heck it is.  and it still 
> wasnt getting triggered for my prog! :(
> It took me digging around in the actual puppet core to realize that that 
> routine would really be better named as
> 
>   change_to_state(oldstate,newstate)
> 
> !!

The reason it's called 'change_to_s' is that most Ruby objects support a 'to_s' 
method that converts them to a string, and this is a means of overriding how a 
given change gets converted to a string.  It would normally go on the Change 
class, but that doesn't work for this case because of how transactions work 
(the types don't have a special Change subclass, and, um, they shouldn't).

> 
> PS: oops, you didnt say which "exec.rb". provider/exec.rb does not have, but 
> type/exec.rb does.
> 
> I tried moving it into my type file, but it still does not seem to get called.

It needs to be inside the :ensure property - and yes, I meant type/exec.rb.

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