summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2005-07-11 17:37:40 +0000
committerLuke Kanies <luke@madstop.com>2005-07-11 17:37:40 +0000
commit649d59a24cf03387e58fa1d4a151fcf34e409777 (patch)
tree5f7ca422618bd78d29025aa6947d814f0e4908bf /lib
parentcb95dc753267205bd5b352434bc5518dcd07e70d (diff)
downloadpuppet-649d59a24cf03387e58fa1d4a151fcf34e409777.tar.gz
puppet-649d59a24cf03387e58fa1d4a151fcf34e409777.tar.xz
puppet-649d59a24cf03387e58fa1d4a151fcf34e409777.zip
adding some more tests for recursion plus checksumming, because they are somewhat incompatible for directories
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@353 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
-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":