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