summaryrefslogtreecommitdiff
path: root/lib/chef/cookbook
diff options
context:
space:
mode:
authorVasu1105 <vasundhara.jagdale@msystechnologies.com>2019-10-22 14:12:22 +0530
committerVasu1105 <vasundhara.jagdale@msystechnologies.com>2020-01-22 10:50:38 +0530
commit28be43bc6476e5ee7eb0a83d8cdc2e8db00489bd (patch)
tree3b5f497f04a1a94b88edb0847b42b2502a4e5bcb /lib/chef/cookbook
parent87645e71e0141f2409a9b06513e36878ba7164ef (diff)
downloadchef-28be43bc6476e5ee7eb0a83d8cdc2e8db00489bd.tar.gz
Deprecated the load method in cookbook_version_loader and added deprecation warning for it. Updated code to raise error if cookbook repo has cookbook directory without cookbook files, this is to make sure user should fix their cookbook repo and remove any garbage from cookbook repository and then do bulk upload.
Signed-off-by: Vasu1105 <vasundhara.jagdale@msystechnologies.com>
Diffstat (limited to 'lib/chef/cookbook')
-rw-r--r--lib/chef/cookbook/cookbook_version_loader.rb28
1 files changed, 4 insertions, 24 deletions
diff --git a/lib/chef/cookbook/cookbook_version_loader.rb b/lib/chef/cookbook/cookbook_version_loader.rb
index 8d4c3208fd..fe3652bbdf 100644
--- a/lib/chef/cookbook/cookbook_version_loader.rb
+++ b/lib/chef/cookbook/cookbook_version_loader.rb
@@ -65,14 +65,6 @@ class Chef
# Load the cookbook. Raises an error if the cookbook_path given to the
# constructor doesn't point to a valid cookbook.
def load!
- # file_paths_map = load
-
- # if empty?
- # raise Exceptions::CookbookNotFoundInRepo, "The directory #{cookbook_path} does not contain a cookbook"
- # end
-
- # file_paths_map
-
metadata # force lazy evaluation to occur
# re-raise any exception that occurred when reading the metadata
@@ -83,8 +75,9 @@ class Chef
remove_ignored_files
if empty?
- Chef::Log.warn "Found a directory #{cookbook_name} in the cookbook path, but it contains no cookbook files. skipping."
+ raise Exceptions::CookbookNotFoundInRepo, "The directory #{cookbook_path} does not contain a cookbook"
end
+
cookbook_settings
end
@@ -92,23 +85,10 @@ class Chef
# directory as the cookbook_path. This behavior is provided for
# compatibility, it is recommended to use #load! instead.
def load
- Chef::Log.warn "This method is deprecated. Use load! instead"
- # metadata # force lazy evaluation to occur
-
- # re-raise any exception that occurred when reading the metadata
- # raise_metadata_error!
-
- # load_all_files
-
- # remove_ignored_files
-
- # if empty?
- # Chef::Log.warn "Found a directory #{cookbook_name} in the cookbook path, but it contains no cookbook files. skipping."
- # end
- # cookbook_settings
+ Chef::Log.warn "load method is deprecated. Use load! instead"
end
- alias :load_cookbooks :load
+ alias :load_cookbooks :load!
def cookbook_version
return nil if empty?