summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xlib/puppet/type/exec.rb2
-rwxr-xr-xtest/test3
-rwxr-xr-xtest/types/exec.rb21
3 files changed, 25 insertions, 1 deletions
diff --git a/lib/puppet/type/exec.rb b/lib/puppet/type/exec.rb
index 04ba9fa6c..01870770c 100755
--- a/lib/puppet/type/exec.rb
+++ b/lib/puppet/type/exec.rb
@@ -179,7 +179,7 @@ module Puppet
# Support both arrays and colon-separated fields.
def value=(*values)
- @value = values.collect { |val|
+ @value = values.flatten.collect { |val|
val.split(":")
}.flatten
end
diff --git a/test/test b/test/test
index 586f4957a..5939b862a 100755
--- a/test/test
+++ b/test/test
@@ -10,6 +10,7 @@ require 'getoptlong'
include Find
result = GetoptLong.new(
+ [ "--build", "-b", GetoptLong::NO_ARGUMENT ],
[ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
[ "--verbose", "-v", GetoptLong::NO_ARGUMENT ],
[ "--help", "-h", GetoptLong::NO_ARGUMENT ]
@@ -21,6 +22,8 @@ $options = {}
result.each { |opt,arg|
case opt
+ when "--build"
+ $options[:build] = true
when "--verbose"
$options[:verbose] = true
when "--debug"
diff --git a/test/types/exec.rb b/test/types/exec.rb
index 918fa62be..7718825ee 100755
--- a/test/types/exec.rb
+++ b/test/types/exec.rb
@@ -641,6 +641,27 @@ and stuff"
)
end
end
+
+ # make sure paths work both as arrays and strings
+ def test_paths_as_arrays
+ path = %w{/usr/bin /usr/sbin /sbin}
+ exec = nil
+ assert_nothing_raised("Could not use an array for the path") do
+ exec = Puppet::Type.type(:exec).create(:command => "echo yay",
+ :path => path)
+ end
+ assert_equal(path, exec[:path], "array-based path did not match")
+ assert_nothing_raised("Could not use a string for the path") do
+ exec = Puppet::Type.type(:exec).create(:command => "echo yay",
+ :path => path.join(":"))
+ end
+ assert_equal(path, exec[:path], "string-based path did not match")
+ assert_nothing_raised("Could not use a colon-separated strings in an array for the path") do
+ exec = Puppet::Type.type(:exec).create(:command => "echo yay",
+ :path => ["/usr/bin", "/usr/sbin:/sbin"])
+ end
+ assert_equal(path, exec[:path], "colon-separated array path did not match")
+ end
end
# $Id$