Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-8114

Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 4.10.4
    • Fix Version/s: PUP 5.4.0
    • Component/s: Types and Providers
    • Labels:
    • Environment:

      SLES 11
      I'm running SP3 on a VMware virtual machine but should not be relevant.

    • Template:
      PUP Bug Template
    • Acceptance Criteria:
      Hide

      The `redhat` service provider considers a service with chkconfig status of "B" to be enabled. Eg:

      $ chkconfig boot.kdump
      boot.kdump  B
      

      Show
      The `redhat` service provider considers a service with chkconfig status of " B " to be enabled. Eg: $ chkconfig boot.kdump boot.kdump B
    • Sub-team:
    • Team:
      Platform Core
    • Sprint:
      Platform Core KANBAN
    • Method Found:
      Needs Assessment
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Services using the "redhat" provider are now considered to be enabled under a greater number of conditions. This primarily affects boot services on SUSE Linux Enterprise Server systems.
    • QA Risk Assessment:
      Needs Assessment

      Description

      Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.

      Pull request: https://github.com/puppetlabs/puppet/pull/6333

      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
      

      This doesn't trigger the rescue block with its false return value as a disabled or nonexistent service would for RHEL.

      So, if the OS family is not 'Suse' and we didn't hit the rescue block, it returns true. If the OS family is 'Suse', output must contain the service name followed by 'on' in order for it to return true. As we've seen above, the boot.* services print an output of <service_name> B and thus return false even when enabled.

        Attachments

          Activity

            jsd-sla-details-panel

              People

              • Assignee:
                jorie Jorie Tappa
                Reporter:
                nrwahl2 Reid Wahl
              • Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: