Hi,

I'm unfortunately more a java/c/c++/perl guy than a ruby kind of
programmer :-(

I started working on a service provider for daemontools, but I'm stuck
with the following issue:

Here is a snippet of my provider I produced using pattern matching from
other providers:

Puppet::Type.type(:service).provide :daemontools, :parent => :base do
    desc "Daemontools service management."

    commands :svc  => "/usr/bin/svc"
    commands :svstat => "/usr/bin/svstat"

    class << self
        attr_accessor :defpath
        attr_accessor :srcpath
    end

    case Facter["operatingsystem"].value
    when "Debian":
        @defpath = "/etc/service"
        @srcpath = "/var/lib/service"
    else
        @defpath = "/service"
        @srcpath = "/var/lib/service"
    end

...
    def enabled?
        appdir = File.join(self.defpath, @resource[:name])
        FileTest.symlink?(appdir)
    end
...

Unfortunately, when puppet calls my service provider to know if a provider
is enabled, it fails with:
err: //Service[dnscache]: Failed to retrieve current state of resource:
undefined method `defpath' for
#<Puppet::Type::Service::ProviderDaemontools:0x7fec6f440198>

OK, so I rewrote enabled? to use @defpath, but now it fails with:
err: //Service[dnscache]: Failed to retrieve current state of resource:
can't convert nil into String

There is certainly something I missed, I understand that the provider
class is built  from scratch with parts from the service class and parts
from my provider.

What is the way to access properties of my provider in the provider method
(like status, start, stop...)

Thanks,
-- 
Brice Figureau
Days of Wonder


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