summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortylercloke <tylercloke@gmail.com>2015-07-02 09:47:11 -0700
committertylercloke <tylercloke@gmail.com>2015-07-06 14:36:03 -0700
commitdb6ee7b3fedb5763e9108a0254c4201b84e84fef (patch)
tree4bd11ef3f682a28e30c0f87fb4472aed8d18a449
parent96f1e1a4f2dcd6acfb5657da28fc004c038c6422 (diff)
downloadchef-db6ee7b3fedb5763e9108a0254c4201b84e84fef.tar.gz
Default Chef::ChefFS::...::ChefServerRootDir.rest to use API V0 and deprecated chef_rest.
Unfortunately, chef_rest was using the now outdated Chef::HTTP so I could not default it to API V0. It was also being used anywhere except Chef::ChefFS::FileSystem::CookbooksDir, which can just as easially use rest instead of chef_rest as they provide the same interface. That update has been made.
-rw-r--r--lib/chef/chef_fs/file_system/chef_server_root_dir.rb10
-rw-r--r--lib/chef/chef_fs/file_system/cookbooks_dir.rb4
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/chef/chef_fs/file_system/chef_server_root_dir.rb b/lib/chef/chef_fs/file_system/chef_server_root_dir.rb
index 370308ee0a..7b2a5e6cb9 100644
--- a/lib/chef/chef_fs/file_system/chef_server_root_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server_root_dir.rb
@@ -90,14 +90,22 @@ class Chef
end
def rest
- Chef::ServerAPI.new(chef_server_url, :client_name => chef_username, :signing_key_filename => chef_private_key, :raw_output => true)
+ Chef::ServerAPI.new(chef_server_url, :client_name => chef_username, :signing_key_filename => chef_private_key, :raw_output => true, :api_version => "0")
end
def get_json(path)
Chef::ServerAPI.new(chef_server_url, :client_name => chef_username, :signing_key_filename => chef_private_key).get(path)
end
+ def chef_rest_deprecation_method
+<<-EOH
+The chef_rest method is being removed from ChefServerRootDir in Chef 13.
+Please update your code to use the rest method instead.
+EOH
+ end
+
def chef_rest
+ Chef::Log.deprecation(chef_rest_deprecation_method)
Chef::REST.new(chef_server_url, chef_username, chef_private_key)
end
diff --git a/lib/chef/chef_fs/file_system/cookbooks_dir.rb b/lib/chef/chef_fs/file_system/cookbooks_dir.rb
index 27bedd3827..3864601622 100644
--- a/lib/chef/chef_fs/file_system/cookbooks_dir.rb
+++ b/lib/chef/chef_fs/file_system/cookbooks_dir.rb
@@ -106,7 +106,7 @@ class Chef
cookbook_to_upload.freeze_version if options[:freeze]
# Instantiate a new uploader based on the proxy loader
- uploader = Chef::CookbookUploader.new(cookbook_to_upload, :force => options[:force], :rest => root.chef_rest)
+ uploader = Chef::CookbookUploader.new(cookbook_to_upload, :force => options[:force], :rest => root.rest)
with_actual_cookbooks_dir(temp_cookbooks_path) do
upload_cookbook!(uploader)
@@ -128,7 +128,7 @@ class Chef
def upload_unversioned_cookbook(other, options)
cookbook_to_upload = other.chef_object
cookbook_to_upload.freeze_version if options[:freeze]
- uploader = Chef::CookbookUploader.new(cookbook_to_upload, :force => options[:force], :rest => root.chef_rest)
+ uploader = Chef::CookbookUploader.new(cookbook_to_upload, :force => options[:force], :rest => root.rest)
with_actual_cookbooks_dir(other.parent.file_path) do
upload_cookbook!(uploader)