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

systemd service provider missing double dash

    XMLWordPrintable

Details

    • Coremunity
    • Platform Core KANBAN
    • Bug Fix
    • Hide
      puppet can no manage systemd services whose names start with dash, such as the " -.mount" unit.

      Thanks to Justin Collier (j-collier) for the contribution
      Show
      puppet can no manage systemd services whose names start with dash, such as the " -.mount" unit. Thanks to Justin Collier (j-collier) for the contribution
    • 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

        Issue Links

          Activity

            People

              j-collier Justin Collier
              runejuhl Rune Juhl Jacobsen
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support