Add check for existence of smf service
--- puppet-3.8.6/lib/puppet/provider/service/smf.rb.orig 2016-04-19 14:26:51.367951573 -0700
+++ puppet-3.8.6/lib/puppet/provider/service/smf.rb 2016-04-19 14:27:31.661139999 -0700
@@ -1,3 +1,7 @@
+#######################################################################
+# Oracle has modified the originally distributed contents of this file.
+#######################################################################
+
# Solaris 10 SMF-style services.
Puppet::Type.type(:service).provide :smf, :parent => :base do
desc <<-EOT
@@ -80,9 +84,18 @@
return
end
+ # get the current state and the next state, and if the next
+ # state is set (i.e. not "-") use it for state comparison
+
+ # Check to see if the service exists
+ cmd = Array[command(:svccfg), "select", @resource[:name]]
+ output = Puppet::Util::Execution.execute(
+ cmd, :combine => true, :failonfail => false)
+ if $CHILD_STATUS.exitstatus != 0
+ info output
+ end
+
begin
- # get the current state and the next state, and if the next
- # state is set (i.e. not "-") use it for state comparison
states = svcs("-H", "-o", "state,nstate", @resource[:name]).chomp.split
state = states[1] == "-" ? states[0] : states[1]
rescue Puppet::ExecutionFailure