summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasu1105 <vasundhara.jagdale@msystechnologies.com>2019-10-22 02:00:17 +0530
committerVasu1105 <vasundhara.jagdale@msystechnologies.com>2020-01-22 10:50:37 +0530
commit87645e71e0141f2409a9b06513e36878ba7164ef (patch)
treeba28dba32b322ec1d28c279e7e11d40175aab4c8
parent03257148dd5228049084258f0c4d926f9c5d28ee (diff)
downloadchef-87645e71e0141f2409a9b06513e36878ba7164ef.tar.gz
Added deprecation warning for load and checking the impact
Signed-off-by: Vasu1105 <vasundhara.jagdale@msystechnologies.com>
-rw-r--r--lib/chef/cookbook/cookbook_version_loader.rb35
-rw-r--r--lib/chef/cookbook_loader.rb2
2 files changed, 26 insertions, 11 deletions
diff --git a/lib/chef/cookbook/cookbook_version_loader.rb b/lib/chef/cookbook/cookbook_version_loader.rb
index f9ec765e47..8d4c3208fd 100644
--- a/lib/chef/cookbook/cookbook_version_loader.rb
+++ b/lib/chef/cookbook/cookbook_version_loader.rb
@@ -65,19 +65,14 @@ 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
+ # file_paths_map = load
- if empty?
- raise Exceptions::CookbookNotFoundInRepo, "The directory #{cookbook_path} does not contain a cookbook"
- end
+ # if empty?
+ # raise Exceptions::CookbookNotFoundInRepo, "The directory #{cookbook_path} does not contain a cookbook"
+ # end
- file_paths_map
- end
+ # file_paths_map
- # Load the cookbook. Does not raise an error if given a non-cookbook
- # directory as the cookbook_path. This behavior is provided for
- # compatibility, it is recommended to use #load! instead.
- def load
metadata # force lazy evaluation to occur
# re-raise any exception that occurred when reading the metadata
@@ -93,6 +88,26 @@ class Chef
cookbook_settings
end
+ # Load the cookbook. Does not raise an error if given a non-cookbook
+ # 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
+ end
+
alias :load_cookbooks :load
def cookbook_version
diff --git a/lib/chef/cookbook_loader.rb b/lib/chef/cookbook_loader.rb
index 5d4ec71d80..f02b07eaaf 100644
--- a/lib/chef/cookbook_loader.rb
+++ b/lib/chef/cookbook_loader.rb
@@ -95,7 +95,7 @@ class Chef
loader = cookbook_version_loaders[cookbook_name]
- loader.load
+ loader.load!
cookbook_version = loader.cookbook_version
cookbooks_by_name[cookbook_name] = cookbook_version