Add support for degraded state in smf and remove unused variable stime.
Submitted upstream as PUP-6095
--- puppet-3.8.6/lib/puppet/provider/service/smf.rb.orig 2016-04-19 14:56:32.596751150 -0700
+++ puppet-3.8.6/lib/puppet/provider/service/smf.rb 2016-04-19 14:59:32.495860166 -0700
@@ -36,11 +36,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})
@@ -71,7 +72,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]]
@@ -112,6 +113,8 @@
return :stopped
when "maintenance"
return :maintenance
+ when "degraded"
+ return :degraded
when "legacy_run"
raise Puppet::Error,
"Cannot manage legacy services through SMF"