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

launchd service provider doesn't implement status override.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 4.6.0
    • Component/s: Types and Providers
    • Labels:
      None
    • Environment:

      Systemd platforms and launchd platforms (osx, possibly freebsd)

    • Template:
    • Acceptance Criteria:
      Hide

      service

      { 'fake_service': ensure => running, start => '/bin/echo start command', status => '/bin/true', hasstatus => false, }

      should say running. not changed 'stopped' to 'running'

      Show
      service { 'fake_service': ensure => running, start => '/bin/echo start command', status => '/bin/true', hasstatus => false, } should say running. not changed 'stopped' to 'running'
    • Story Points:
      3
    • Sprint:
      Client 2016-05-18, Client 2016-06-01
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Previously, the launchd service provider did not support overriding `status` with `hasstatus => false`. This change adds that capability.

      Description

      I'm seeing some odd behaviour when trying to override the status command of a service which seems to be being ignored.

      According to the docs, setting hasstatus to false and adding a custom command to the status attribute should allow me to fine tune how Puppet tries to determine if my service is running...

      If a service’s init script does not support any kind of status command, you should set hasstatus to false and either provide a specific command using the status attribute or expect that Puppet will look for the service name in the process table.

      and for status...

      Specify a status command manually. This command must return 0 if the service is running and a nonzero value otherwise.

      I've boiled my problem down to the following example code

      service { 'fake_service':
        ensure    => running,
        start     => '/bin/echo start command',
        status    => '/bin/true',
        hasstatus => false,
      }
      

      The behaviour I would expect from this is that when evaluating the service, puppet will run {{ /bin/true }} to determine if the service is up, which will return 0, and then stop there since the service should always be deemed running. However when I run the above code I see that the status command is never run and puppet insists on querying the service through systemctl....

      Debug: Executing '/usr/bin/systemctl is-active fake_service'
      Debug: Executing '/bin/echo start command'
      Notice: /Stage[main]/Main/Service[fake_service]/ensure: ensure changed 'stopped' to 'running'
      

      So far I've seen this on Puppet 4.3.1 (MacOS) and Puppet 3.8.4 (Redhat 7.1)

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  crayfishx Craig Dunn
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  8 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: