diff options
author | danielsdeleo <dan@getchef.com> | 2015-02-06 09:43:09 -0800 |
---|---|---|
committer | danielsdeleo <dan@getchef.com> | 2015-02-11 10:52:49 -0800 |
commit | 6c9f246b04c23906dd5297d178a423c96bc7b369 (patch) | |
tree | b12595c7931c0c9a8d9962ec9e6469f7483998aa /lib/chef | |
parent | 677ca0d7e3366ea9b3b6a912c8c6c28d543e2046 (diff) | |
download | chef-6c9f246b04c23906dd5297d178a423c96bc7b369.tar.gz |
Temporarily implement deprecation warnings as errors
This is an intermediate step where we're cleaning up all internal code
to convert cookbook version objects to JSON in the new way.
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/chef_fs/chef_fs_data_store.rb | 2 | ||||
-rw-r--r-- | lib/chef/cookbook_uploader.rb | 7 | ||||
-rw-r--r-- | lib/chef/cookbook_version.rb | 28 |
3 files changed, 34 insertions, 3 deletions
diff --git a/lib/chef/chef_fs/chef_fs_data_store.rb b/lib/chef/chef_fs/chef_fs_data_store.rb index 9b4f7320b8..5f147720eb 100644 --- a/lib/chef/chef_fs/chef_fs_data_store.rb +++ b/lib/chef/chef_fs/chef_fs_data_store.rb @@ -147,7 +147,7 @@ class Chef # get /cookbooks/NAME/version result = nil begin - result = entry.chef_object.to_hash + result = Chef::CookbookManifest.new(entry.chef_object).to_hash rescue Chef::ChefFS::FileSystem::NotFoundError => e raise ChefZero::DataStore::DataNotFoundError.new(to_zero_path(e.entry), e) end diff --git a/lib/chef/cookbook_uploader.rb b/lib/chef/cookbook_uploader.rb index 2d8bf5bc7e..826b362a3d 100644 --- a/lib/chef/cookbook_uploader.rb +++ b/lib/chef/cookbook_uploader.rb @@ -92,9 +92,12 @@ class Chef # files are uploaded, so save the manifest cookbooks.each do |cb| - save_url = opts[:force] ? cb.force_save_url : cb.save_url + + manifest = Chef::CookbookManifest.new(cb) + + save_url = opts[:force] ? manifest.force_save_url : manifest.save_url begin - rest.put(save_url, cb) + rest.put(save_url, manifest) rescue Net::HTTPServerException => e case e.response.code when "409" diff --git a/lib/chef/cookbook_version.rb b/lib/chef/cookbook_version.rb index c26ab46565..4e3e8069a6 100644 --- a/lib/chef/cookbook_version.rb +++ b/lib/chef/cookbook_version.rb @@ -64,18 +64,46 @@ class Chef end def save_url + # TODO: double check this code suggestion + msg = <<-WARNING +Cookbooks now have multiple save URLs based on the capabilities of the Chef Server. +To get the default save URL, use code like `Chef::CookbookManifest.new(cookbook_version).save_url` +WARNING + raise msg + # TODO: change to warning cookbook_manifest.save_url end def force_save_url + # TODO: double check this code suggestion + msg = <<-WARNING +Cookbooks now have multiple save URLs based on the capabilities of the Chef Server. +To get the default save URL, use code like `Chef::CookbookManifest.new(cookbook_version).force_save_url` +WARNING + raise msg + # TODO: change to warning cookbook_manifest.force_save_url end def to_hash + # TODO: double check this code suggestion + msg = <<-WARNING +Cookbooks now have multiple JSON representations based on the capabilities of the Chef Server. +To get the Hash representation, use code like `Chef::CookbookManifest.new(cookbook_version).to_hash` +WARNING + raise msg + # TODO: change to warning cookbook_manifest.to_hash end def to_json(*a) + # TODO: double check this code suggestion + msg = <<-WARNING +Cookbooks now have multiple JSON representations based on the capabilities of the Chef Server. +To get the JSON representation, use code like `Chef::CookbookManifest.new(cookbook_version).to_json` +WARNING + raise msg + # TODO: change to warning cookbook_manifest.to_json end |