summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2016-02-23 09:52:20 +0000
committerThom May <thom@chef.io>2016-03-03 09:46:30 +0000
commitb62e6ae14ddd9c60035f4ec314f4c6d0ab47777e (patch)
treeacd055045c217f0650e96c02d2744832028c1dcc
parenta4d98365c1d68d7a24fba62783538951d2bbd2e0 (diff)
downloadchef-tm/zero_deep_libraries.tar.gz
Ensure that chef-zero loads libraries recursivelytm/zero_deep_libraries
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb2
-rw-r--r--lib/chef/cookbook/cookbook_version_loader.rb2
-rw-r--r--lib/chef/run_context/cookbook_compiler.rb1
-rw-r--r--spec/integration/knife/chef_repository_file_system_spec.rb4
4 files changed, 7 insertions, 2 deletions
diff --git a/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb b/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb
index 3a08768baf..92295b4fe8 100644
--- a/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb
@@ -53,7 +53,7 @@ class Chef
:attributes => { :ruby_only => true },
:definitions => { :ruby_only => true },
:recipes => { :ruby_only => true },
- :libraries => { :ruby_only => true },
+ :libraries => { :recursive => true },
:templates => { :recursive => true },
:files => { :recursive => true },
:resources => { :ruby_only => true, :recursive => true },
diff --git a/lib/chef/cookbook/cookbook_version_loader.rb b/lib/chef/cookbook/cookbook_version_loader.rb
index 48fa6a03a1..d9b027f322 100644
--- a/lib/chef/cookbook/cookbook_version_loader.rb
+++ b/lib/chef/cookbook/cookbook_version_loader.rb
@@ -86,7 +86,7 @@ class Chef
load_as(:attribute_filenames, "attributes", "*.rb")
load_as(:definition_filenames, "definitions", "*.rb")
load_as(:recipe_filenames, "recipes", "*.rb")
- load_recursively_as(:library_filenames, "libraries", "*.rb")
+ load_recursively_as(:library_filenames, "libraries", "*")
load_recursively_as(:template_filenames, "templates", "*")
load_recursively_as(:file_filenames, "files", "*")
load_recursively_as(:resource_filenames, "resources", "*.rb")
diff --git a/lib/chef/run_context/cookbook_compiler.rb b/lib/chef/run_context/cookbook_compiler.rb
index e8311a18a6..bdf3a1251c 100644
--- a/lib/chef/run_context/cookbook_compiler.rb
+++ b/lib/chef/run_context/cookbook_compiler.rb
@@ -186,6 +186,7 @@ class Chef
def load_libraries_from_cookbook(cookbook_name)
files_in_cookbook_by_segment(cookbook_name, :libraries).each do |filename|
+ next unless File.extname(filename) == ".rb"
begin
Chef::Log.debug("Loading cookbook #{cookbook_name}'s library file: #{filename}")
Kernel.load(filename)
diff --git a/spec/integration/knife/chef_repository_file_system_spec.rb b/spec/integration/knife/chef_repository_file_system_spec.rb
index e431c7f612..cc538c98c0 100644
--- a/spec/integration/knife/chef_repository_file_system_spec.rb
+++ b/spec/integration/knife/chef_repository_file_system_spec.rb
@@ -231,6 +231,10 @@ EOM
/cookbooks/cookbook1/files/c/e.json
/cookbooks/cookbook1/libraries/
/cookbooks/cookbook1/libraries/a.rb
+/cookbooks/cookbook1/libraries/b.json
+/cookbooks/cookbook1/libraries/c/
+/cookbooks/cookbook1/libraries/c/d.rb
+/cookbooks/cookbook1/libraries/c/e.json
/cookbooks/cookbook1/providers/
/cookbooks/cookbook1/providers/a.rb
/cookbooks/cookbook1/providers/c/