summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet')
-rwxr-xr-xlib/puppet/type/exec.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/puppet/type/exec.rb b/lib/puppet/type/exec.rb
index 730417cda..a68bfb189 100755
--- a/lib/puppet/type/exec.rb
+++ b/lib/puppet/type/exec.rb
@@ -70,7 +70,7 @@ module Puppet
@checks.keys
end
- newproperty(:returns) do |property|
+ newproperty(:returns, :array_matching => :all) do |property|
include Puppet::Util::Execution
munge do |value|
value.to_s
@@ -79,8 +79,9 @@ module Puppet
defaultto "0"
attr_reader :output
- desc "The expected return code. An error will be returned if the
- executed command returns something else. Defaults to 0."
+ desc "The expected return code(s). An error will be returned if the
+ executed command returns something else. Defaults to 0. Can be
+ specified as an array of acceptable return codes or a single value."
# Make output a bit prettier
def change_to_s(currentvalue, newvalue)
@@ -131,9 +132,9 @@ module Puppet
end
end
- if status.exitstatus.to_s != self.should.to_s
- self.fail("%s returned %s instead of %s" %
- [self.resource[:command], status.exitstatus, self.should.to_s])
+ unless self.should.include?(status.exitstatus.to_s)
+ self.fail("%s returned %s instead of one of [%s]" %
+ [self.resource[:command], status.exitstatus, self.should.join(",")])
end
return event