-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
end
end
+ # returns the daemon dir on this node
+ def daemondir
+ self.defpath
+ end
end
attr_writer :servicedir
@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
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