simple site.pp question

6 views
Skip to first unread message

Jeff Leggett

unread,
May 19, 2008, 1:53:12 PM5/19/08
to Puppet Users
My site.pp:

file { "/etrade/home/jleggett/puppettest":
owner => jleggett,
mode => 644,
ensure => present,
}

service { "bluetooth":
ensure => stopped,
}

The first works fine, the second is not stopping bluetooth not a valid
value for ensure maybe? What are ALL the valid values for ensure?
(Can't seem to find that in wiki) shouldn't there be an erorr in logs
somewhere that stopped is not a valid value?

[jleggett@lxp6d4m3 manifests]$ sudo /sbin/service bluetooth status
hcid (pid 9313) is running...
sdpd (pid 9317) is running...
[jleggett@lxp6d4m3 manifests]$
[jleggett@lxp6d4m3 manifests]$ tail /var/log/messages
May 19 12:03:24 lxp6d4m3 puppetd[9096]: Starting catalog run
May 19 12:03:24 lxp6d4m3 puppetd[9096]: Finished catalog run in 0.05
seconds
May 19 12:29:29 lxp6d4m3 ntpd[2377]: can't open /etc/ntp/drift.TEMP:
Permission denied
May 19 12:33:24 lxp6d4m3 puppetd[9096]: Starting catalog run
May 19 12:33:24 lxp6d4m3 puppetd[9096]: Finished catalog run in 0.05
seconds
May 19 13:03:23 lxp6d4m3 puppetd[9096]: Starting catalog run
May 19 13:03:23 lxp6d4m3 puppetd[9096]: Finished catalog run in 0.05
seconds
May 19 13:29:29 lxp6d4m3 ntpd[2377]: can't open /etc/ntp/drift.TEMP:
Permission denied
May 19 13:33:23 lxp6d4m3 puppetd[9096]: Starting catalog run
May 19 13:33:23 lxp6d4m3 puppetd[9096]: Finished catalog run in 0.05
seconds

Blake Barnett

unread,
May 19, 2008, 2:27:06 PM5/19/08
to puppet...@googlegroups.com

On May 19, 2008, at 10:53 AM, Jeff Leggett wrote:

>
> My site.pp:
>
> file { "/etrade/home/jleggett/puppettest":
> owner => jleggett,
> mode => 644,
> ensure => present,
> }
>
> service { "bluetooth":
> ensure => stopped,
> }

Because the running daemons don't match the service name you'll need
to specify a way to check for status, or a pattern to use when running
ps:
For example:
status => "/bin/ps -ef | /bin/grep h[c]id"

http://reductivelabs.com/trac/puppet/wiki/TypeReference#service

-Blake

Jeff Leggett

unread,
May 19, 2008, 3:17:46 PM5/19/08
to Puppet Users
Ah I see... I took where it said that Red Hat was both:

# enableable: The provider can enable and disable the service
# refreshable: The provider can restart the service.

That it "knew" already how to do so. I see now, it needs the status
for a service. That's not really clear in the Type Reference.

Peter Meier

unread,
May 19, 2008, 3:32:40 PM5/19/08
to puppet...@googlegroups.com
Hi

> Ah I see... I took where it said that Red Hat was both:
>
> # enableable: The provider can enable and disable the service
> # refreshable: The provider can restart the service.
>
> That it "knew" already how to do so. I see now, it needs the status
> for a service. That's not really clear in the Type Reference.


the problem is that many distros don't have the status in the init.d
scripts, this is why hasstatus is set to false by default.

you can set hasstatus => true which will also work for your case.

greets Pete

AJ

unread,
May 19, 2008, 5:10:31 PM5/19/08
to puppet...@googlegroups.com
Hiya!

This only works when the init scripts conform to the LSB[1]
specifications.. i.e.
$? = 0 RUNNING
$? = 3 NOT RUNNING

If the init script does not conform, it's recommended (as earlier
posted) to specify 'pattern' with a regex match on the process name
(Ruby Regex, 'ntp' == /ntp/)
> greets Pete
>
> >
>
Regards,

AJ

[1]
http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html

Reply all
Reply to author
Forward
0 new messages