The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

Feature #1630

exec type should allow passing of arguments as an array rather than a string

Added by Sam Quigley over 5 years ago. Updated about 1 year ago.

Status:AcceptedStart date:10/04/2008
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:exec
Target version:-
Affected Puppet version:0.24.4 Branch:
Keywords:

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com

This ticket may be automatically exported to the PUP project on JIRA using the button below:


Description

The exec type takes commands and arguments as a string, (@“echo foo”@) which will then get passed to /bin/sh (@sh -c “echo foo”@) by Kernel#system.

This can make things pretty awkward if the command you’re trying to execute contains shell metacharacters or quotes of its own, and under appropriately pathological conditions could even be a security problem… (username ‘“&&rm -rf /’ or something? shrug)

It’d be grand if the exec type would support passing things around as arrays. eg:

exec {"example":
  command => "/bin/echo",
  arguments => ["*", "yay", "*"],
}

(Passing an array to Kernel#system bypasses the shell completely: http://www.ruby-doc.org/core/classes/Kernel.html#M005982)

-sq


Related issues

Related to Puppet - Bug #19697: giving an array as the command parameter of exec throws a... Duplicate
Related to Puppet - Bug #6553: handling of array values in exec provider is inconsistent. Accepted 03/02/2011

History

#1 Updated by James Turnbull over 5 years ago

  • Category set to exec
  • Status changed from Unreviewed to Needs Decision
  • Assignee set to Luke Kanies

#2 Updated by Luke Kanies over 5 years ago

  • Status changed from Needs Decision to Accepted
  • Assignee changed from Luke Kanies to Puppet Community

#3 Updated by James Turnbull almost 5 years ago

  • Assignee deleted (Puppet Community)

#4 Updated by Stefan Schulte almost 3 years ago

I guess that is fixed now along with #4884?

#5 Updated by Charlie Sharpsteen about 1 year ago

Bi-yearly followup: specifying the command attribute of exec resources as an Array was not implemented in #4884.

Also available in: Atom PDF