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

systemd service provider missing double dash

    Details

    • Template:
    • Team:
      Platform OS
    • QA Risk Assessment:
      Needs Assessment

      Description

      The systemd service provider doesn't use double dashes for ending options, meaning that it will fail on any service with a name beginning with a - (dash):

      13:52:54 runejuhl@tolu:~
      $ /opt/puppetlabs/bin/puppet --version
      4.9.2
      13:53:00 runejuhl@tolu:~ 
      $ /opt/puppetlabs/bin/puppet apply -e "service { '-h-asd': enable=>true}" | head
      Notice: Compiled catalog for tolu.petardo.dk in environment production in 0.27 seconds
      systemctl [OPTIONS...] {COMMAND} ...
       
      Query or send control commands to the systemd manager.
       
        -h --help           Show this help
           --version        Show package version
           --system         Connect to system manager
           --user           Connect to user service manager
        -H --host=[USER@]HOST
      Error: Failed to apply catalog: Broken pipe @ io_write - <STDOUT>
      

      Units starting with - are fairly common in systemd, e.g. the -.mount unit.

      For a quick fix, it looks like changing https://github.com/puppetlabs/puppet/blob/master/lib/puppet/provider/service/systemd.rb#L47 like this would work (albeit only when enabling/disabling):

      - output = systemctl(action, @resource[:name])
      + output = systemctl(action, '--', @resource[:name])
      

        Attachments

          Activity

            jsd-sla-details-panel

              People

              • Assignee:
                Unassigned
                Reporter:
                runejuhl Rune Juhl Jacobsen
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: