summaryrefslogtreecommitdiff
path: root/lib/chef/cookbook
diff options
context:
space:
mode:
authorVasu1105 <vasundhara.jagdale@msystechnologies.com>2019-10-22 14:12:22 +0530
committerTim Smith <tsmith84@gmail.com>2020-01-22 22:42:27 -0800
commit93e025efbf1b3fadf873da5cee1a6e6ed13afd5a (patch)
tree10a98667ee8d51360ad8590f1f5930b5c52cffee /lib/chef/cookbook
parent69560f82984aaf08602c8449d5992609a121d796 (diff)
downloadchef-93e025efbf1b3fadf873da5cee1a6e6ed13afd5a.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?