Issue #2087 has been updated by Martin Englund.
Status changed from Needs design decision to Ready for Testing
Complexity changed from Unknown to Trivial
Here's a patch which changes the warning to a notice, which is enough to make
the reports shut up.
It also uses some svcs options to make it easier to parse the output.
<pre>
diff --git a/lib/puppet/provider/service/smf.rb
b/lib/puppet/provider/service/smf.rb
index 83c99f2..009b85c 100755
--- a/lib/puppet/provider/service/smf.rb
+++ b/lib/puppet/provider/service/smf.rb
@@ -65,41 +65,27 @@ Puppet::Type.type(:service).provide :smf, :parent => :base
do
end
begin
- output = svcs "-l", @resource[:name]
+ output = svcs "-H -o state", @resource[:name]
rescue Puppet::ExecutionFailure
- warning "Could not get status on service %s" % self.name
+ notice "Could not get status on service %s" % self.name
return :stopped
end
- output.split("\n").each { |line|
- var = nil
- value = nil
- if line =~ /^(\w+)\s+(.+)/
- var = $1
- value = $2
- else
- Puppet.err "Could not match %s" % line.inspect
- next
- end
- case var
- when "state"
- case value
- when "online"
- #self.warning "matched running %s" % line.inspect
- return :running
- when "offline", "disabled", "uninitialized"
- #self.warning "matched stopped %s" % line.inspect
- return :stopped
- when "legacy_run"
- raise Puppet::Error,
- "Cannot manage legacy services through SMF"
- else
- raise Puppet::Error,
- "Unmanageable state '%s' on service %s" %
- [value, self.name]
- end
- end
- }
+ case output
+ when "online"
+ #self.warning "matched running %s" % line.inspect
+ return :running
+ when "offline", "disabled", "uninitialized"
+ #self.warning "matched stopped %s" % line.inspect
+ return :stopped
+ when "legacy_run"
+ raise Puppet::Error,
+ "Cannot manage legacy services through SMF"
+ else
+ raise Puppet::Error,
+ "Unmanageable state '%s' on service %s" %
+ [output, self.name]
+ end
end
def stopcmd</pre>
----------------------------------------
Feature #2087: Not installed is the same as not running
http://projects.reductivelabs.com/issues/2087
Author: Martin Englund
Status: Ready for Testing
Priority: Low
Assigned to: Martin Englund
Category: service
Target version: unplanned
Complexity: Trivial
Affected version: 0.24.7
Keywords:
Service should not complain if it should be disabled, but is missing:
Tue Mar 17 00:23:32 -0700 2009 Service[rpc-100235](provider=smf) (warning):
Could not get status on service svc:/network/rpc-100235_1/rpc_ticotsord:default
An alternative would be to add a new parameter
service { "svc:/network/rpc-100235_1/rpc_ticotsord:default":
ensure => stopped,
ismissing => warn
}
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://reductivelabs.com/redmine/my/account
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/puppet-bugs?hl=en
-~----------~----~----~----~------~----~------~--~---