I must be missing something here... Anyone?
Doug
Have you tested that this is the case?
Because I'm essentially positive that Puppet is using chkconfig
correctly. I don't know enough about chkconfig to confirm this for
you, but lots of people are using it happily.
And there's no need to double post.
--
If a dog jumps onto your lap it is because he is fond of you; but if a
cat does the same thing it is because your lap is warmer.
-- Alfred North Whitehead
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com
> I'm not sure how your service is getting into the state it's in, but
> the problem is a faulty or damaged installation of the service, not
> improper behavior of Puppet. Puppet service management assumes that
> the service is already correctly installed, and that includes the
> runlevel directories being set up. In my experience, RPMs that
> contain services are expected to set up the runlevel directories, and
> they pretty reliably do so.
>
> I strongly oppose having the the Service resource run chkconfig --add,
> at least without a parameter specifically instructing it to do so. It
> would otherwise be operating outside its area of responsibility, and
> as much as that would solve your problem, it would be likely to bite
> someone else.
>
> If you cannot rely on your service being correctly installed, then you
> should manage that with a separate resource, and make your Service
> resource depend on that. You demonstrate exactly that approach in a
> later post, but I think it could be tidied up a bit and packaged more
> conveniently with a defined type. Here's a first, untested draft,
> derived from your own example:
The problem is that 'chkconfig <service> on' does an implicit add of
the service; but it does a half-assed job, in that it only adds the
start links, not the kill links. Thus, it is very easy to get into
the broken state by doing a 'chkconfig --del <service>', followed by
'chkconfig <service> on'. I get exactly that behaviour for e.g.
the puppetmaster service when I try. I didn't expect that.
If 'chkconfig foo on', and by extension 'service {"foo": enabled=>true;}',
had given us an error message if the "foo" service hadn't been properly
--add:ed, it would have been much better. I just realized that I have
had this happen to me as well, since I install a couple of init.d scripts
from Puppet and then just do 'service {"foo": enabled=>true;}' for them.
Luckily, those service scripts don't do anything interresting in their
stop sections, so I haven't had any problems from it, but still.
I actually can't think of any situation where you wan't to enable a
service without having it added as well, so I don't think there would
be any harm in Puppet doing a 'chkconfig --add' as well when enabling
a service. Given the current, imho rather strange, behaviour of
chkconfig, I think that would be the least surprising thing to do.
/Bellman
For what it's worth, this all works great in sles (at least sles 11 -
haven't checked elsewhere):
uldbdb204e:/etc/rc.d # chkconfig snmpd
snmpd on
uldbdb204e:/etc/rc.d # find . -name '*snmpd*'
./rc3.d/K01snmpd
./rc3.d/S08snmpd
./snmpd
./rc5.d/K01snmpd
./rc5.d/S08snmpd
./rc2.d/K01snmpd
./rc2.d/S08snmpd
uldbdb204e:/etc/rc.d # chkconfig snmpd off
uldbdb204e:/etc/rc.d # find . -name '*snmpd*'
./snmpd
uldbdb204e:/etc/rc.d # chkconfig snmpd on
uldbdb204e:/etc/rc.d # find . -name '*snmpd*'
./rc3.d/K01snmpd
./rc3.d/S08snmpd
./snmpd
./rc5.d/K01snmpd
./rc5.d/S08snmpd
./rc2.d/K01snmpd
./rc2.d/S08snmpd
As a debianista I obviously haven't touched chkconfig ever. But in the
spirit of DWIM, I would expect a provider to do the magic to get (in
this case) an init-script under the control of the chosen tool.
Regards, DavidS
> On Nov 10, 10:13 am, Thomas Bellman <bell...@nsc.liu.se> wrote:
>> The problem is that 'chkconfig <service> on' does an implicit add of
>> the service; but it does a half-assed job, in that it only adds the
>> start links, not the kill links. Thus, it is very easy to get into
>> the broken state by doing a 'chkconfig --del <service>', followed by
>> 'chkconfig <service> on'. I get exactly that behaviour for e.g.
>> the puppetmaster service when I try. I didn't expect that.
> Why did you have any particular expectation for that scenario at all,
> though? I agree that chkconfig has some quality-of-implementation
> issues, but the bottom line is that it has no documented behavior for
> the scenario you describe. If you want predictable, stable results
> then you should stick to the documented behaviors of your tools.
I expected it to either give me an error message about the service
needing to be --add:ed, or to do a proper --add itself. I actually
expected it to give me an error message.
The problem is not that I knowingly did a 'chkconfig <service> on'
without a --add before; it is that I *forgot* to do a --add on a
homemade init script, or relied on Puppet to do it for me (which
it did in earlier versions), or I used Puppet to disable the service,
which earlier did a --del on the service, but now have decided to
enable it again when Puppet no longer does a --add.
It is too easy to get into this state without any indication that
something is amiss. And it probably even works (i.e the service
gets up and running automatically again after the reboot) in the
majority of cases, so usually you don't see any symptoms either.
It's bad interface design.
> Following the principle of exercising only documented behavior, I
> think Puppet's "redhat" service provider should recognize only those
> services reported by chkconfig --list. That would prevent Puppet from
> causing a misconfiguration by turning on a service not already managed
> by chkconfig. If an ability to register a service with chkconfig is
> needed (not clear to me that it is), then that should be controlled by
> a separate parameter.
I would be fine with that. As long as I get an error message when I
try to do something stupid, I'm content. (And as long as it is OK to
try to *disable* a service that doesn't exist.)
However, I think it would be slightly better if Puppet did a chkconfig
--add on services you enable (and documented this!), since I can't think
of a situation where you don't want that behaviour, but plenty where you
*do* wan't to --add. Sure, you can do the --add yourself with an exec,
but it is more convenient if the service type does it automatically.
> And for what it's worth, I never use chkconfig --del unless I'm
> removing the service from the system altogether. If for some reason I
> need to leave a service on the system that must never automatically
> run, then I chkconfig --level 0123456 <service> off. YMMV.
Likewise. Unless I use earlier versions of Puppet, which did a --del
when I asked it to disable the service. But I *do* occasionally install
my own init scripts using a file resource.
/Bellman