components/ruby/puppet/patches/puppet-06-provider-smf.patch
changeset 7565 48aa82a0931f
parent 7564 f958607559a6
child 7566 34f2284a605f
equal deleted inserted replaced
7564:f958607559a6 7565:48aa82a0931f
     1 Add check for existence of smf service
       
     2 
       
     3 --- puppet-3.8.6/lib/puppet/provider/service/smf.rb.orig	2016-04-19 14:26:51.367951573 -0700
       
     4 +++ puppet-3.8.6/lib/puppet/provider/service/smf.rb	2016-04-19 14:27:31.661139999 -0700
       
     5 @@ -1,3 +1,7 @@
       
     6 +#######################################################################
       
     7 +# Oracle has modified the originally distributed contents of this file.
       
     8 +#######################################################################
       
     9 +
       
    10  # Solaris 10 SMF-style services.
       
    11  Puppet::Type.type(:service).provide :smf, :parent => :base do
       
    12    desc <<-EOT
       
    13 @@ -80,9 +84,18 @@
       
    14        return
       
    15      end
       
    16  
       
    17 +    # get the current state and the next state, and if the next
       
    18 +    # state is set (i.e. not "-") use it for state comparison
       
    19 +
       
    20 +    # Check to see if the service exists
       
    21 +    cmd = Array[command(:svccfg), "select", @resource[:name]]
       
    22 +    output = Puppet::Util::Execution.execute(
       
    23 +        cmd, :combine => true, :failonfail => false)
       
    24 +    if $CHILD_STATUS.exitstatus != 0
       
    25 +      info output
       
    26 +    end
       
    27 +
       
    28      begin
       
    29 -      # get the current state and the next state, and if the next
       
    30 -      # state is set (i.e. not "-") use it for state comparison
       
    31        states = svcs("-H", "-o", "state,nstate", @resource[:name]).chomp.split
       
    32        state = states[1] == "-" ? states[0] : states[1]
       
    33      rescue Puppet::ExecutionFailure