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

service enable=mask fails when service isn't present

    XMLWordPrintable

    Details

    • Template:
      PUP Bug Template
    • Agent OS:
      CentOS 7
    • Team:
      Coremunity
    • Sprint:
      Platform Core KANBAN
    • Method Found:
      Needs Assessment
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      It's now possible to mask a systemd service that doesn't (yet) exist.
    • QA Risk Assessment:
      Needs Assessment

      Description

      Puppet Version: 6.21.1, 7.5.0
      Puppet Server Version: N/A
      OS Name/Version: CentOS 7

      With the systemd provider, setting enable to mask on a service that does not exist fails.

      Desired Behavior:

      Masking a service should work whether or not the service exists (the way that setting enable to false works either way).

      Actual Behavior:

      [root@puppet ~]# systemctl list-unit-files | grep madeup
      [root@puppet ~]# puppet resource service madeup
      service { 'madeup':
       ensure => 'stopped',
       enable => 'false',
       provider => 'systemd',
      }
      [root@puppet ~]# puppet resource service madeup enable=mask
      Error: Could not disable madeup: 
      Error: /Service[madeup]/enable: change from 'false' to 'mask' failed: Could not disable madeup: 
      service { 'madeup':
       enable => 'false',
       provider => 'systemd',
      }
      [root@puppet ~]# systemctl mask madeup
      Created symlink from /etc/systemd/system/madeup.service to /dev/null.
      [root@puppet ~]# systemctl list-unit-files | grep madeup
      madeup.service masked

      The error here appears to be coming from https://github.com/puppetlabs/puppet/blob/85bd9ed07e3e6c956f1972624a50be914292e1ab/lib/puppet/provider/service/systemd.rb#L162.  If I wrap that in a begin block, the service is masked properly.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              josh Josh Cooper
              Reporter:
              silug Steven Pritchard
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support