[PUP-3485] Exec "command" Attribute Only Autorequires First Path in String Created: 2014/10/17  Updated: 2015/01/26  Resolved: 2015/01/26

Status: Closed
Project: Puppet
Component/s: Types and Providers
Affects Version/s: PUP 3.7.1
Fix Version/s: None

Type: Improvement Priority: Normal
Reporter: Ryan Gard Assignee: Josh Cooper
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File command_before_file_autorequire.pp    
QA Contact: Ryan Gard



If a user uses an "command" attribute with multiple paths only the first will be evaluated for autorequire. Example below:

exec { 'Manifest Test':
  command => '/bin/bash /tmp/manifest/test.sh'
file { '/tmp/manifest/test.sh':
  ensure  => file,
  content => "#!/bin/bash\necho \"Super Fun\" > /tmp/manifest/test.txt",
  mode    => '0777'
file { '/tmp/manifest':
  ensure => directory

It would be more helpful for the end user to have all paths in the "command" attribute be evaluated for autorequire.


  • Manifest

Repro Steps

  1. Install PE on master with Puppet Server enabled.
  2. Verify master is operational.
  3. Copy the attached manifest to the Puppet agent.
  4. On the master execute the following command:

    puppet apply command_before_file_autorequire.pp


The Puppet agent run should complete successfully.


The Puppet agent run fails:

Info: Retrieving plugin
        Info: Loading facts
        Info: Caching catalog for gl76xwb6hl2rw0w
        Info: Applying configuration version '1413566905'
        Error: /bin/bash: /tmp/manifest/test.sh: No such file or directory
        Error: /Stage[main]/Main/Node[default]/Exec[Manifest Test]/returns: change from notrun to 0 failed: /bin/bash: /tmp/manifest/test.sh: No such file or directory

Comment by Charlie Sharpsteen [ 2014/10/17 ]

Personally, I don't think Exec autorequire should attempt to be this clever. What if there are arguments between the executable and the path? How do we determine that the command line has gotten sufficiently complex that autorequire processing should give up? As a user, I would prefer explicit requires over an autorequire subject to subtle bugs and complicated edge cases.

Comment by Josh Cooper [ 2015/01/26 ]

+1 to "should not attempt to be this clever", going to close this.

Generated at Wed Apr 01 14:35:03 PDT 2020 using Jira 8.5.2#805002-sha1:a66f9354b9e12ac788984e5d84669c903a370049.