summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2005-07-10 04:48:00 +0000
committerLuke Kanies <luke@madstop.com>2005-07-10 04:48:00 +0000
commit05d59fd02ff55e1f74dc7bb16a240ede74cebbc1 (patch)
treecc4d7520986d38622bf5146553ee2f20bcfa09f2
parent5b7fd635d3829e037ffc4ef511ca34d752c3e6b4 (diff)
downloadpuppet-05d59fd02ff55e1f74dc7bb16a240ede74cebbc1.tar.gz
puppet-05d59fd02ff55e1f74dc7bb16a240ede74cebbc1.tar.xz
puppet-05d59fd02ff55e1f74dc7bb16a240ede74cebbc1.zip
fixing a nasty bug related to recursion and nonexistent files
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@347 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r--lib/puppet/type/pfile.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb
index e8d459fe6..e5b657831 100644
--- a/lib/puppet/type/pfile.rb
+++ b/lib/puppet/type/pfile.rb
@@ -73,10 +73,18 @@ module Puppet
sum = ""
case @checktype
when "md5":
+ if FileTest.directory?(self.parent[:path])
+ Blink.verbose "Cannot MD5 sum directory %s" %
+ self.parent[:path]
+ end
File.open(self.parent[:path]) { |file|
sum = Digest::MD5.hexdigest(file.read)
}
when "md5lite":
+ if FileTest.directory?(self.parent[:path])
+ Blink.verbose "Cannot MD5 sum directory %s" %
+ self.parent[:path]
+ end
File.open(self.parent[:path]) { |file|
sum = Digest::MD5.hexdigest(file.read(512))
}
@@ -376,7 +384,8 @@ module Puppet
@stat = nil
# if recursion is enabled and we're a directory...
- if @parameters[:recurse] and self.stat.directory?
+ if @parameters[:recurse] and FileTest.exist?(self[:path]) and
+ self.stat.directory?
recurse = self[:recurse]
# we might have a string, rather than a number
if recurse.is_a?(String)