summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/puppet6
-rwxr-xr-xtest/executables/puppetbin.rb22
2 files changed, 27 insertions, 1 deletions
diff --git a/bin/puppet b/bin/puppet
index bb8160e7a..8ded2304c 100755
--- a/bin/puppet
+++ b/bin/puppet
@@ -158,7 +158,11 @@ Puppet.genmanifest
if code
master[:Code] = code
else
- master[:Manifest] = ARGV.shift
+ if ARGV.length > 0
+ master[:Manifest] = ARGV.shift
+ else
+ master[:Code] = STDIN.read
+ end
end
# Allow users to load the classes that puppetd creates.
diff --git a/test/executables/puppetbin.rb b/test/executables/puppetbin.rb
index 4fde6ba59..1752848a8 100755
--- a/test/executables/puppetbin.rb
+++ b/test/executables/puppetbin.rb
@@ -64,6 +64,28 @@ class TestPuppetBin < Test::Unit::TestCase
assert(FileTest.exists?(path), "Failed to create config'ed file")
end
+
+ def test_stdin_execution
+ path = tempfile()
+ manifest = tempfile()
+ env = %x{which env}.chomp
+ if env == ""
+ Puppet.info "cannot find env; cannot test stdin_execution"
+ return
+ end
+ File.open(manifest, "w") do |f|
+ f.puts "#!#{env} puppet
+ file { '#{path}': ensure => file }"
+ end
+ File.chmod(0755, manifest)
+
+ assert_nothing_raised {
+ out = %x{#{manifest} 2>&1}
+ }
+ assert($? == 0, "manifest exited with code %s" % $?.to_i)
+
+ assert(FileTest.exists?(path), "Failed to create config'ed file")
+ end
end
# $Id$