summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
authorJohn Keiser <jkeiser@opscode.com>2013-08-09 21:13:46 -0700
committerJohn Keiser <jkeiser@opscode.com>2013-09-12 23:10:55 -0700
commitc7d8640e30f9d0d9063ff5fcedfb0183174d7e6c (patch)
tree1bcba676ef88e028fc521386cb6bfd0423d45426 /lib/chef
parentfb0c00c186a734b60986ff64423f092ec86d74cf (diff)
downloadchef-c7d8640e30f9d0d9063ff5fcedfb0183174d7e6c.tar.gz
Invalidate "children" caches when children are added
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/chef_fs/file_system.rb5
-rw-r--r--lib/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb2
-rw-r--r--lib/chef/chef_fs/file_system/cookbooks_dir.rb1
-rw-r--r--lib/chef/chef_fs/file_system/data_bags_dir.rb1
-rw-r--r--lib/chef/chef_fs/file_system/file_system_entry.rb9
-rw-r--r--lib/chef/chef_fs/file_system/multiplexed_dir.rb1
-rw-r--r--lib/chef/chef_fs/file_system/rest_list_dir.rb2
7 files changed, 11 insertions, 10 deletions
diff --git a/lib/chef/chef_fs/file_system.rb b/lib/chef/chef_fs/file_system.rb
index e3c5c05077..f2478c4680 100644
--- a/lib/chef/chef_fs/file_system.rb
+++ b/lib/chef/chef_fs/file_system.rb
@@ -143,11 +143,6 @@ class Chef
found_result = true
new_dest_parent = get_or_create_parent(dest, options, ui, format_path)
child_error = copy_entries(src, dest, new_dest_parent, recurse_depth, options, ui, format_path)
- # Create the internal representation of the fact that the parent will now exist
- if !new_dest_parent.nil? and !new_dest_parent.parent.nil? and\
- !new_dest_parent.parent.children.include? new_dest_parent
- new_dest_parent.parent.children << new_dest_parent
- end
error ||= child_error
end
if !found_result && pattern.exact_path
diff --git a/lib/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb b/lib/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb
index 6396e031e1..61b3cfb5c7 100644
--- a/lib/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb
@@ -54,7 +54,7 @@ class Chef
Dir.mkdir(path)
end
child = make_child_entry(name)
- @children << child
+ @children = nil
child
end
diff --git a/lib/chef/chef_fs/file_system/cookbooks_dir.rb b/lib/chef/chef_fs/file_system/cookbooks_dir.rb
index c6af933290..0a1e01c93b 100644
--- a/lib/chef/chef_fs/file_system/cookbooks_dir.rb
+++ b/lib/chef/chef_fs/file_system/cookbooks_dir.rb
@@ -63,6 +63,7 @@ class Chef
end
def create_child_from(other, options = {})
+ @children = nil
upload_cookbook_from(other, options)
end
diff --git a/lib/chef/chef_fs/file_system/data_bags_dir.rb b/lib/chef/chef_fs/file_system/data_bags_dir.rb
index 46c3c21cf6..d0404c284b 100644
--- a/lib/chef/chef_fs/file_system/data_bags_dir.rb
+++ b/lib/chef/chef_fs/file_system/data_bags_dir.rb
@@ -64,6 +64,7 @@ class Chef
raise Chef::ChefFS::FileSystem::OperationFailedError.new(:create_child, self, e), "HTTP error creating child '#{name}': #{e}"
end
end
+ @children = nil
DataBagDir.new(name, self, true)
end
end
diff --git a/lib/chef/chef_fs/file_system/file_system_entry.rb b/lib/chef/chef_fs/file_system/file_system_entry.rb
index c9df58ceda..8b6549a664 100644
--- a/lib/chef/chef_fs/file_system/file_system_entry.rb
+++ b/lib/chef/chef_fs/file_system/file_system_entry.rb
@@ -47,13 +47,14 @@ class Chef
end
def create_child(child_name, file_contents=nil)
- result = FileSystemEntry.new(child_name, self)
+ child = FileSystemEntry.new(child_name, self)
if file_contents
- result.write(file_contents)
+ child.write(file_contents)
else
- Dir.mkdir(result.file_path)
+ Dir.mkdir(child.file_path)
end
- result
+ @children = nil
+ child
end
def dir?
diff --git a/lib/chef/chef_fs/file_system/multiplexed_dir.rb b/lib/chef/chef_fs/file_system/multiplexed_dir.rb
index a7a901e304..01d8bfe7f2 100644
--- a/lib/chef/chef_fs/file_system/multiplexed_dir.rb
+++ b/lib/chef/chef_fs/file_system/multiplexed_dir.rb
@@ -40,6 +40,7 @@ class Chef
end
def create_child(name, file_contents = nil)
+ @children = nil
write_dir.create_child(name, file_contents)
end
end
diff --git a/lib/chef/chef_fs/file_system/rest_list_dir.rb b/lib/chef/chef_fs/file_system/rest_list_dir.rb
index 594fec8ab6..7e4a33813b 100644
--- a/lib/chef/chef_fs/file_system/rest_list_dir.rb
+++ b/lib/chef/chef_fs/file_system/rest_list_dir.rb
@@ -89,6 +89,8 @@ class Chef
end
end
+ @children = nil
+
result
end