summaryrefslogtreecommitdiffstats
path: root/lib/puppet/provider/exec/shell.rb
blob: ad2171005b75f7d325205c7c4e374cfbe694e199 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Puppet::Type.type(:exec).provide :shell, :parent => :posix do
  include Puppet::Util::Execution

  confine :feature => :posix

  desc <<-EOT
    Passes the provided command through `/bin/sh`; only available on
    POSIX systems. This allows the use of shell globbing and built-ins, and
    does not require that the path to a command be fully-qualified. Although
    this can be more convenient than the `posix` provider, it also means that
    you need to be more careful with escaping; as ever, with great power comes
    etc. etc.

    This provider closely resembles the behavior of the `exec` type
    in Puppet 0.25.x.
  EOT

  def run(command, check = false)
    command = %Q{/bin/sh -c "#{command.gsub(/"/,'\"')}"}
    super(command, check)
  end

  def validatecmd(command)
    true
  end
end