summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
authorVasu1105 <vasundhara.jagdale@msystechnologies.com>2019-10-22 02:00:17 +0530
committerTim Smith <tsmith84@gmail.com>2020-01-22 22:42:23 -0800
commit69560f82984aaf08602c8449d5992609a121d796 (patch)
treeef2c65caf418d0affd9466dd32b25579f14b4bf4 /lib/chef
parentd87e62bf524a257f2e7ac1418953bea82ea1e4d9 (diff)
downloadchef-69560f82984aaf08602c8449d5992609a121d796.tar.gz
Added deprecation warning for load and checking the impact
Signed-off-by: Vasu1105 <vasundhara.jagdale@msystechnologies.com>
Diffstat (limited to 'lib/chef')
-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