$OpenBSD: patch-lib_puppet_provider_service_openbsd_rb,v 1.2 2013/03/08 16:19:15 ajacoutot Exp $
--- lib/puppet/provider/service/openbsd.rb.orig	Fri Mar  8 17:18:07 2013
+++ lib/puppet/provider/service/openbsd.rb	Fri Mar  8 17:18:21 2013
@@ -0,0 +1,38 @@
+Puppet::Type.type(:service).provide :openbsd, :parent => :init do
+
+  desc "Provider for OpenBSD."
+
+  confine :operatingsystem => [:openbsd]
+  defaultfor :operatingsystem => [:openbsd]
+
+  class << self
+    attr_accessor :defpath
+  end
+
+  @defpath = "/etc/rc.d"
+
+  def startcmd
+    [self.initscript, "-f", :start]
+  end
+
+  def restartcmd
+    (@resource[:hasrestart] == :true) && [self.initscript, "-f", :restart]
+  end
+
+  def statuscmd
+    [self.initscript, :check]
+  end
+
+  # A simple wrapper so execution failures are a bit more informative.
+  # If an exception occurs, we show a warning instead of an error.
+  def texecute(type, command, fof = true)
+    begin
+      # #565: Services generally produce no output, so squelch them.
+      execute(command, :failonfail => fof, :squelch => true)
+    rescue Puppet::ExecutionFailure => detail
+      @resource.warning "Could not #{type} #{@resource.ref}: #{detail}"
+    end
+    nil
+  end
+
+end
