summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik Jäger <gitcommit@henk.geekmail.org>2022-05-22 13:00:50 +0200
committerHendrik Jäger <gitcommit@henk.geekmail.org>2022-07-25 23:53:04 +0200
commit50a5fa416e558000e56c0bbea7815da02c16e2a1 (patch)
tree74b82a9774256a968508b89f33f234f954657b0d
parent630c0ffabfd003113daadd580b6b030db21ef432 (diff)
become independent of daemontools provider, differences are too big
-rw-r--r--lib/puppet/provider/service/s6.rb23
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