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

Request: Add "source" and "content" attributes to the exec resource

    XMLWordPrintable

Details

    • New Feature
    • Status: Accepted
    • Normal
    • Resolution: Unresolved
    • None
    • None
    • None
    • Needs Assessment

    Description

      As a puppet user
      I want the exec resource to support the "source" and "content" attributes
      So that I do not need to push a file resource and maintain the link between the two.

       

      There is a fairly common use pattern of file -> exec, where you want to exec a fairly complicated action, or even just two commands that need to share some environment that two execs would not share. The file resource pushes down the script. The exec resource runs the script.

      file { '/usr/bin/somescript':
        ...
      }

      exec {'do the thing':
        ensure => present,
        command => '/usr/bin/somescript',
        requires => File['/usr/bin/somescript'],
      }

      It becomes very easy to create failures when one resource is updated without the other being modified, especially if they are in different classes or separated by some space. A common fault might occur when the script name is changed in the file resource only. The exec will fail on every run because its command does not exist.

      The request is for an exec resource that can include the script as part of the resource. There would be no need to put a file in a specific path, the script can either be held in memory or stored in a temporary space on the system. It would look something like:

      exec {'do the thing':
        ensure => present,
        source => 'puppet:///modules/profile/do_the_thing.sh',
      }

      The content attribute could be helpful as well when the command requires some templating.

      exec {'do the thing':
        ensure => present,
        content => template('profile/do_the_thing.sh.erb'),
      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            rnelson0@gmail.com Rob Nelson
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Zendesk Support