On Aug 25, 2008, at 1:41 PM, Brice Figureau wrote:

>
>
> Once again more questions...
>
> On Mon, August 25, 2008 01:15, Luke Kanies wrote:
>>
>> On Aug 24, 2008, at 1:41 PM, Brice Figureau wrote:
>>> +
>>> +    # Mark that our services supports 'status' commands
>>> unconditionally
>>> +    def hasstatus=(value)
>>> +        @parameters[:hasstatus] = true
>>> +    end
>>
>> Doesn't daemontools always have status?  In that case, you should
>> probably have a different default for this value.
>
> I think I misread your comment in first instance.
> I wanted to tell to the base service and the resource that there will
> always a status command for all the services managed by this provider.
>
> What would be the best way to achieve that?

This method is in the 'init' class, for example:

     # If it was specified that the init script has a 'status'  
command, then
     # we just return that; otherwise, we return false, which causes  
it to
     # fallback to other mechanisms.
     def statuscmd
         if @resource[:hasstatus] == :true
             return [self.initscript, :status]
         else
             return false
         end
     end

The 'hasstatus' parameter has no default value, so you can provide an  
equivalent command, but rather than checking for whether 'hasstatus'  
is set to true, check for whether it's set to false.  I.e., if the  
user hasn't specifically said there's no status, then assume there's a  
status.

The above method, btw, is used by the 'init' class (or maybe 'base'?)  
-- if you implement your own 'status' method, then you probably aren't  
using this method.

You should be able to track the code paths to figure out how to do it,  
though.

-- 
Experience is that marvelous thing that enables you recognize a
mistake when you make it again. -- F. P. Jones
---------------------------------------------------------------------
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