summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-08-28 23:28:22 -0700
committerLuke Kanies <luke@madstop.com>2008-08-28 23:28:22 -0700
commit93fc1139550bd97a11529b812e77ac0fc00c6079 (patch)
tree66ef90dc4dcfa02c012307f80d84a2b194877d9d /lib
parentbd1163a339ff66dbb9a50a1cb13f6320cb056cc3 (diff)
downloadpuppet-93fc1139550bd97a11529b812e77ac0fc00c6079.tar.gz
puppet-93fc1139550bd97a11529b812e77ac0fc00c6079.tar.xz
puppet-93fc1139550bd97a11529b812e77ac0fc00c6079.zip
Files now use the Indirector to recurse locally.
I don't yet have integration tests for remote recursion or link recursion, but we're nearly there. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/type/file.rb21
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb
index 2ae1e61b7..a59192af3 100644
--- a/lib/puppet/type/file.rb
+++ b/lib/puppet/type/file.rb
@@ -322,10 +322,14 @@ module Puppet
# Create any children via recursion or whatever.
def eval_generate
- raise(Puppet::DevError, "File recursion cannot happen without a catalog") unless catalog
-
return nil unless self.recurse?
- recurse.reject { |resource| catalog.resource(:file, resource[:path]) }.each do |child|
+
+ raise(Puppet::DevError, "Cannot generate resources for recursion without a catalog") unless catalog
+
+ recurse.reject do |resource|
+ catalog.resource(:file, resource[:path])
+ end.each do |child|
+ catalog.add_resource child
catalog.relationship_graph.add_edge self, child
end
end
@@ -559,11 +563,11 @@ module Puppet
full_path = File.join(self[:path], path)
# the right-side hash wins in the merge.
- options = to_hash.merge(:path => full_path)
+ options = to_hash.merge(:path => full_path, :implicit => true)
options.delete(:parent) if options.include?(:parent)
options.delete(:recurse) if options.include?(:recurse)
- return catalog.create_implicit_resource(self.class.name, options)
+ return self.class.create(options)
end
# Files handle paths specially, because they just lengthen their
@@ -641,7 +645,12 @@ module Puppet
# Recurse the file itself, returning a Metadata instance for every found file.
def recurse_local
- perform_recursion(self[:path]).inject({}) { |hash, meta| hash[meta.relative_path] = newchild(meta.relative_path); hash }
+ perform_recursion(self[:path]).inject({}) do |hash, meta|
+ next hash if meta.relative_path == "."
+
+ hash[meta.relative_path] = newchild(meta.relative_path)
+ hash
+ end
end
# Recurse against our remote file.