summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorMatt Robinson <matt@puppetlabs.com>2011-03-15 11:52:10 -0700
committerMatt Robinson <matt@puppetlabs.com>2011-03-15 11:55:59 -0700
commit0d2d6f3f005ee99658ff86b79749f0ba7949beab (patch)
treeee6fcbc2dacc11f321c5877a9bdaaae46359db06 /lib/puppet
parentd2e911a1f9dae2cda025bc0f2cbc973cdcff309b (diff)
downloadpuppet-0d2d6f3f005ee99658ff86b79749f0ba7949beab.tar.gz
puppet-0d2d6f3f005ee99658ff86b79749f0ba7949beab.tar.xz
puppet-0d2d6f3f005ee99658ff86b79749f0ba7949beab.zip
(#4884) Add an shell provider for execs
This makes it possible to use shell builtins when the exec is inline bash commands. Paired-with: Max Martin
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/provider/exec/shell.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/puppet/provider/exec/shell.rb b/lib/puppet/provider/exec/shell.rb
new file mode 100644
index 000000000..98f309e8f
--- /dev/null
+++ b/lib/puppet/provider/exec/shell.rb
@@ -0,0 +1,17 @@
+Puppet::Type.type(:exec).provide :shell, :parent => :posix do
+ include Puppet::Util::Execution
+
+ confine :feature => :posix
+
+ desc "Execute external binaries directly, on POSIX systems.
+passing through a shell so that shell built ins are available."
+
+ def run(command, check = false)
+ command = %Q{/bin/sh -c "#{command.gsub(/"/,'\"')}"}
+ super(command, check)
+ end
+
+ def validatecmd(command)
+ true
+ end
+end