|
Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.
SLES 11 has a list of Sys V services beginning with the string 'boot.' that do not behave like other services when `chkconfig` is run against them. To illustrate: ``` $ cat /etc/SuSE-release SUSE Linux Enterprise Server 11 (x86_64) VERSION = 11 PATCHLEVEL = 3
-
Service is running
$ /sbin/service boot.kdump status kdump kernel loaded running
-
chkconfig shows 'B'
$ /sbin/chkconfig boot.kdump boot.kdump B
-
Only appears when --allservices is specified
$ /sbin/chkconfig --list | grep kdump $ /sbin/chkconfig --list --allservices | grep kdump boot.kdump 0:off 1:off 2:off 3:off 4:off 5:off 6:off B:on
-
Compare with "normal" service
$ /sbin/service ntp status ...
Checking for network time protocol daemon (NTPD): running
-
chkconfig shows 'on', not 'B'
$ /sbin/chkconfig ntp ntp on ```
The provider script (`puppet/lib/puppet/provider/service/redhat.rb`) uses the following function to test whether a service is enabled. ``` def enabled? name = @resource[:name]
begin output = chkconfig name rescue Puppet::ExecutionFailure return :false end
-
For Suse OS family, chkconfig returns 0 even if the service is disabled or non-existent
-
Therefore, check the output for '<name> on' to see if it is enabled
return :false unless Facter.value(:osfamily) != 'Suse' || output =~ /^# {name}
\s+on$/
:true end ```
It accounts for the fact that SLES, unlike RHEL, returns a zero return code in the event that a service is disabled or nonexistent: ``` $ /sbin/chkconfig asdf asdf: unknown service $ echo $? 0 ```
It doesn't trigger the `rescue` block. So, if the OS family is 'Suse' and `output` contains the service name followed by `'on'`, it returns `true`. However, as we've seen above, the `boot.*` services print an output of `<service_name> B` and thus return `false` even when enabled.
|