Issue #9798 has been updated by Stefan Schulte.
What does running
<pre>
# /etc/init.d/snmpd start
# /etc/init.d/snmpd status
# echo $?
</pre>
return? If it does not return zero (and an init script should return zero if
the service is running) I guess you have to provide an alternative status
command:
<pre>
service {"snmpd":
ensure => running,
enable => true,
hasrestart => true,
hasstatus => true,
status => '/etc/init.d/snmpd status | grep "snmpd is running"'
require => Package ["snmpd"],
}
----------------------------------------
Bug #9798: Puppet saying "changed 'stopped' to 'running'" while the service
*is* running
https://projects.puppetlabs.com/issues/9798
Author: Jurgen Lamsens
Status: Needs More Information
Priority: Normal
Assignee:
Category: provider
Target version:
Affected Puppet version: 2.6.8
Keywords:
Branch:
Let's say you have this manifest:
<pre>
root@tpc1-lucid:~# cat test.pp
class snmp {
package {"snmpd":
ensure => installed,
}
service {"snmpd":
enable => true,
ensure => running,
hasrestart => true,
hasstatus => true,
require => Package ["snmpd"],
}
}
node tpc1-lucid {
include snmp
}
</pre>
And you run it on a clean Ubuntu 10.04 LTS (Lucid), you will have:
<pre>
root@tpc1-lucid:~# puppet -d test.pp
...
notice: /Stage[main]/Snmp/Package[snmpd]/ensure: ensure changed 'purged' to
'present'
debug: Service[snmpd](provider=debian): Executing '/etc/init.d/snmpd status'
debug: Service[snmpd](provider=debian): Executing '/etc/init.d/snmpd start'
notice: /Stage[main]/Snmp/Service[snmpd]/ensure: ensure changed 'stopped' to
'running'
...
</pre>
So the service is started, right ?
<pre>
root@tpc1-lucid:~# ps faux | grep snmp[d]
snmp 2400 0.0 0.9 47560 4784 ? S 11:38 0:00
/usr/sbin/snmpd -Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p
/var/run/snmpd.pid 127.0.0.1
</pre>
Run puppet again:
<pre>
root@tpc1-lucid:~# puppet -d test.pp
...
debug: Service[snmpd](provider=debian): Executing '/etc/init.d/snmpd status'
debug: Service[snmpd](provider=debian): Executing '/etc/init.d/snmpd start'
notice: /Stage[main]/Snmp/Service[snmpd]/ensure: ensure changed 'stopped' to
'running'
...
</pre>
Huh ? Changed stopped to running ? Apparently, the 'status' command for snmp
gives 2 lines of result:
<pre>
root@tpc1-lucid:~# /etc/init.d/snmpd status
* snmpd is running
* snmptrapd is not running
</pre>
When having only 1 line of result...
<pre>
root@tpc1-lucid:~# /etc/init.d/ssh status
* sshd is running
</pre>
... you don't have Puppet restarting the service.
Tx and regards,
Jurgen L.
--
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 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.