Issue #21378 has been updated by Pablo Wright.

Status changed from Unreviewed to Accepted
Assignee set to Charlie Sharpsteen

I think the problem here is that the type reference mentions "init script" when 
talking about the status command, even when the provider might not be an actual 
init-type script.
Looking at base.rb for the service type, there's a comment that says:

  # Check if the process is running.  Prefer the 'status' parameter,
  # then 'statuscmd' method, then look in the process table.

It seems that if you specify a custom status command, it will use that to 
determine status, and hasstatus does not modify this.

I think we could change the wording in the type reference so that it doesn't 
mention an init script to prevent this ambiguity. Sending over to csharpsteen 
for proper status.

----------------------------------------
Bug #21378: Setting a status command on a service calls the status command even 
when hasstatus=true
https://projects.puppetlabs.com/issues/21378#change-94575

* Author: John Morrissey
* Status: Accepted
* Priority: Normal
* Assignee: Charlie Sharpsteen
* Category: 
* Target version: 
* Affected Puppet version: 
* Keywords: 
* Branch: 
----------------------------------------
The agent runs a service's status command even when hasstatus is explicitly set 
to true on that service. Based on the type reference, it seems setting 
hasstatus=true should force the agent to use the service's init script instead 
of the custom status command.

provider/service/redhat.rb seems like it's doing the right thing, so I'm not 
sure where the problem lies.

--
Declare whether the service’s init script has a functional status command; 
defaults to true. This attribute’s default value changed in Puppet 2.7.0.
[...]
If a service’s init script does not support any kind of status command, you 
should set hasstatus to false and either provide a specific command using the 
status attribute or expect that Puppet will look for the service name in the 
process table.
--

[jwm@hsph02:pts/1 ~> lsb_release -d
Description:    CentOS release 5.7 (Final)
[jwm@hsph02:pts/1 ~> rpm -q puppet
puppet-3.2.2-1.el5
[jwm@hsph02:pts/1 ~> cat service-status.pp 
service { 'snmpd':
  ensure => running,
  hasstatus => true,
  status => 'touch /tmp/foo',
}
[jwm@hsph02:pts/1 ~> sudo puppet apply -vd service-status.pp 
[...]
Debug: Loaded state in 0.23 seconds
Info: Applying configuration version '1371763702'
[...]
Debug: Executing 'touch /tmp/foo'



-- 
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://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to