summaryrefslogtreecommitdiff
path: root/lib/chef/cookbook_loader.rb
diff options
context:
space:
mode:
authorVivek Singh <vivek.singh@msystechnologies.com>2019-09-27 16:48:36 +0530
committerVivek Singh <vivek.singh@msystechnologies.com>2019-10-28 14:06:22 +0530
commitf725ddcc52bd7ca5cf3b7ac1ba87778e4c4e39a2 (patch)
tree4897a2672b443308fcd3855c98a8ef4c2002ef24 /lib/chef/cookbook_loader.rb
parent377861d1f1dcd93f39f1e8596db50a63f7650ca2 (diff)
downloadchef-f725ddcc52bd7ca5cf3b7ac1ba87778e4c4e39a2.tar.gz
Fix knife cookbook site share chefignore lookup
Fix cookbook syntax_check dir path error if cookbook_path is an array Fix invalid error if cookbook_path set to nil or empty Array and TypeError: no implicit conversion of nil into String Chefignore for each cookbooks/:cookbook Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
Diffstat (limited to 'lib/chef/cookbook_loader.rb')
-rw-r--r--lib/chef/cookbook_loader.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/chef/cookbook_loader.rb b/lib/chef/cookbook_loader.rb
index b27d751d64..2bafed410d 100644
--- a/lib/chef/cookbook_loader.rb
+++ b/lib/chef/cookbook_loader.rb
@@ -49,8 +49,8 @@ class Chef
# @param repo_paths [Array<String>] the array of repo paths containing cookbook dirs
def initialize(*repo_paths)
- @repo_paths = repo_paths.flatten.map { |p| File.expand_path(p) }
- raise ArgumentError, "You must specify at least one cookbook repo path" if repo_paths.empty?
+ @repo_paths = repo_paths.flatten.compact.map { |p| File.expand_path(p) }
+ raise ArgumentError, "You must specify at least one cookbook repo path" if @repo_paths.empty?
end
# The primary function of this class is to build this Mash mapping cookbook names as a string to
@@ -171,7 +171,7 @@ class Chef
begin
mash = Mash.new
all_directories_in_repo_paths.each do |cookbook_path|
- loader = Cookbook::CookbookVersionLoader.new(cookbook_path, chefignore(File.dirname(cookbook_path)))
+ loader = Cookbook::CookbookVersionLoader.new(cookbook_path, chefignore(cookbook_path))
cookbook_name = loader.cookbook_name
if mash.key?(cookbook_name)
raise Chef::Exceptions::CookbookMergingError, "Cookbook merging is no longer supported, the cookbook named #{cookbook_name} can only appear once in the cookbook_path"