diff options
author | lutter <lutter@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-12-22 01:28:01 +0000 |
---|---|---|
committer | lutter <lutter@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-12-22 01:28:01 +0000 |
commit | be711d357857f5e6d4a28a22bd60dd89e9e136c0 (patch) | |
tree | ce7d65c9491bb7da343b7ce7790584d0202f300f | |
parent | c616572d59b8b5142f64193ab87073fbc3b788f7 (diff) | |
download | puppet-be711d357857f5e6d4a28a22bd60dd89e9e136c0.tar.gz puppet-be711d357857f5e6d4a28a22bd60dd89e9e136c0.tar.xz puppet-be711d357857f5e6d4a28a22bd60dd89e9e136c0.zip |
Allow execution of bare strings as long as there's no attempt to change uid/gid
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1963 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r-- | lib/puppet/util.rb | 2 | ||||
-rwxr-xr-x | test/util/utiltest.rb | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/puppet/util.rb b/lib/puppet/util.rb index 906184c18..bddcf8533 100644 --- a/lib/puppet/util.rb +++ b/lib/puppet/util.rb @@ -272,7 +272,7 @@ module Util command = command.collect { |i| i.to_s } str = command.join(" ") else - raise "Must pass an array" + raise "Must pass an array" unless uid.nil? && gid.nil? str = command end if respond_to? :debug diff --git a/test/util/utiltest.rb b/test/util/utiltest.rb index 3f2532fc2..3e9082bf5 100755 --- a/test/util/utiltest.rb +++ b/test/util/utiltest.rb @@ -308,6 +308,18 @@ class TestPuppetUtil < Test::Unit::TestCase end end + def test_string_exec + cmd = "/bin/echo howdy" + output = nil + assert_nothing_raised { + output = Puppet::Util.execute(cmd) + } + assert_equal("howdy\n", output) + assert_raise(RuntimeError) { + Puppet::Util.execute(cmd, 0, 0) + } + end + # This is mostly to test #380. def test_get_provider_value group = Puppet::Type.type(:group).create :name => "yayness", :ensure => :present |