diff options
-rw-r--r-- | lib/puppet/provider/service/s6.rb | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/lib/puppet/provider/service/s6.rb b/lib/puppet/provider/service/s6.rb index 5e790e2..e414f70 100644 --- a/lib/puppet/provider/service/s6.rb +++ b/lib/puppet/provider/service/s6.rb @@ -1,4 +1,4 @@ -Puppet::Type.type(:service).provide(:s6, :parent => :daemontools) do +Puppet::Type.type(:service).provide(:s6) do desc <<~EOT skarnet.org's small and secure supervision software suite @@ -62,6 +62,10 @@ Puppet::Type.type(:service).provide(:s6, :parent => :daemontools) do end end + # returns the daemon dir on this node + def daemondir + self.defpath + end end attr_writer :servicedir @@ -80,6 +84,21 @@ Puppet::Type.type(:service).provide(:s6, :parent => :daemontools) do @servicedir end + # returns the full path of this service when enabled + # (ie in the service directory) + def service + File.join(self.servicedir, resource[:name]) + end + + # returns the full path to the current daemon directory + # note that this path can be overridden in the resource + # definition + def daemon + path = resource[:path] + raise Puppet::Error.new("#{self.class.name} must specify a path for daemon directory") unless path + File.join(path, resource[:name]) + end + def status begin output = s6_svstat "-u", self.service @@ -95,7 +114,7 @@ Puppet::Type.type(:service).provide(:s6, :parent => :daemontools) do end def enabled? - # the service is enabled if it is linked + # the service is enabled if it is linked case Puppet::FileSystem.symlink?(self.service) ? :true : :false when :true return :true |