summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet')
-rwxr-xr-xlib/puppet/type/exec.rb5
-rw-r--r--lib/puppet/type/pfile.rb24
2 files changed, 23 insertions, 6 deletions
diff --git a/lib/puppet/type/exec.rb b/lib/puppet/type/exec.rb
index dec7370eb..2ae401cca 100755
--- a/lib/puppet/type/exec.rb
+++ b/lib/puppet/type/exec.rb
@@ -161,6 +161,11 @@ module Puppet
return self.state(:returns).output
end
end
+
+ # this might be a very, very bad idea...
+ def refresh
+ self.state(:returns).sync
+ end
end
end
end
diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb
index 98c7ff7bd..dbd54404b 100644
--- a/lib/puppet/type/pfile.rb
+++ b/lib/puppet/type/pfile.rb
@@ -76,18 +76,30 @@ module Puppet
if FileTest.directory?(self.parent[:path])
Puppet.info "Cannot MD5 sum directory %s" %
self.parent[:path]
+
+ # because we cannot sum directories, just remove
+ # the state entirely
+ self.parent.delete(self.name)
+ return
+ else
+ File.open(self.parent[:path]) { |file|
+ sum = Digest::MD5.hexdigest(file.read)
+ }
end
- File.open(self.parent[:path]) { |file|
- sum = Digest::MD5.hexdigest(file.read)
- }
when "md5lite":
if FileTest.directory?(self.parent[:path])
Puppet.info "Cannot MD5 sum directory %s" %
self.parent[:path]
+
+ # because we cannot sum directories, just remove
+ # the state entirely
+ self.parent.delete(self.name)
+ return
+ else
+ File.open(self.parent[:path]) { |file|
+ sum = Digest::MD5.hexdigest(file.read(512))
+ }
end
- File.open(self.parent[:path]) { |file|
- sum = Digest::MD5.hexdigest(file.read(512))
- }
when "timestamp","mtime":
sum = File.stat(self.parent[:path]).mtime
when "time":