22985359 service provider can't cope with degraded instances
authorShawn Ferry <shawn.ferry@oracle.com>
Wed, 30 Mar 2016 13:45:50 -0400
changeset 5746 ffb1e5dafbd6
parent 5745 4c91a451eb79
child 5747 4441137c3e4a
22985359 service provider can't cope with degraded instances
components/ruby/puppet/patches/puppet-11-smf-degraded.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ruby/puppet/patches/puppet-11-smf-degraded.patch	Wed Mar 30 13:45:50 2016 -0400
@@ -0,0 +1,39 @@
+Add support for degraded state in smf and remove unused variable stime.
+Submitted upstream as PUP-6095
+
+diff --git a/lib/puppet/provider/service/smf.rb b/lib/puppet/provider/service/smf.rb
+--- a/lib/puppet/provider/service/smf.rb
++++ b/lib/puppet/provider/service/smf.rb
[email protected]@ -32,11 +32,12 @@
+   end
+
+   def self.instances
+-   svcs("-H").split("\n").select{|l| l !~ /^legacy_run/ }.collect do |line|
+-     state,stime,fmri = line.split(/\s+/)
++   svcs("-H", "-o", "state,fmri" ).split("\n").select{|l| l !~ /^legacy_run/ }.collect do |line|
++     state,fmri = line.split(/\s+/)
+      status =  case state
+                when /online/; :running
+                when /maintenance/; :maintenance
++               when /degraded/; :degraded
+                else :stopped
+                end
+      new({:name => fmri, :ensure => status})
[email protected]@ -67,7 +68,7 @@
+   def startcmd
+     self.setupservice
+     case self.status
+-    when :maintenance
++    when :maintenance, :degraded
+       [command(:adm), :clear, @resource[:name]]
+     else
+       [command(:adm), :enable, "-rs", @resource[:name]]
[email protected]@ -108,6 +109,8 @@
+       return :stopped
+     when "maintenance"
+       return :maintenance
++    when "degraded"
++      return :degraded
+     when "legacy_run"
+       raise Puppet::Error,
+         "Cannot manage legacy services through SMF"