summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet')
-rwxr-xr-xlib/puppet/type/exec.rb23
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/puppet/type/exec.rb b/lib/puppet/type/exec.rb
index e981e67ca..421a1089a 100755
--- a/lib/puppet/type/exec.rb
+++ b/lib/puppet/type/exec.rb
@@ -48,6 +48,7 @@ module Puppet
self.parent[:command]
)
end
+ self.is = nil
end
def sync
@@ -60,10 +61,7 @@ module Puppet
ENV["PATH"] = tmppath
- Puppet.debug("%s: status: %s; returns: %s" %
- [self.parent[:command],status.exitstatus, self.should]
- )
- if status.exitstatus != self.should
+ if status.exitstatus.to_s != self.should.to_s
Puppet.err("%s returned %s" %
[self.parent[:command],status.exitstatus])
@@ -80,9 +78,6 @@ module Puppet
class Type
class Exec < Type
- attr_reader :command, :user, :returns
- # class instance variable
-
# this is kind of hackish, using the return value as the
# state, but apparently namevars can't also be states
# who knew?
@@ -101,10 +96,20 @@ module Puppet
def initialize(hash)
# default to erroring on a non-zero return
- unless hash.include?("returns") or hash.include?(:returns)
- hash["returns"] = 0
+ if hash.include?("returns")
+ if hash["returns"].is_a?(Fixnum)
+ hash["returns"] = hash["returns"].to_s
+ end
+ elsif hash.include?(:returns)
+ if hash["returns"].is_a?(Fixnum)
+ hash[:returns] = hash[:returns].to_s
+ end
+ else
+ Puppet.debug("setting return to 0")
+ hash[:returns] = "0"
end
+
super
if self[:command].nil?