summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2012-12-18 16:34:11 -0800
committerdanielsdeleo <dan@opscode.com>2012-12-18 17:10:05 -0800
commit10b457a41b27a71168c5f86b1bb47c72c44833bc (patch)
tree98def69a2f24bcfaf46dbe8bf8c4daae8e63e0ef
parenta61c9865684466adcc9c933f05eebc1090624ea0 (diff)
downloadchef-10b457a41b27a71168c5f86b1bb47c72c44833bc.tar.gz
[CHEF-3689] remove REST#register (see ApiClient::Registration)
-rw-r--r--lib/chef/rest.rb37
1 files changed, 0 insertions, 37 deletions
diff --git a/lib/chef/rest.rb b/lib/chef/rest.rb
index 2383577369..b1f9063f25 100644
--- a/lib/chef/rest.rb
+++ b/lib/chef/rest.rb
@@ -84,43 +84,6 @@ class Chef
@raw_key
end
- # Register the client
- #--
- # Requires you to load chef/api_client beforehand. explicit require is removed since
- # most users of this class have no need for chef/api_client. This functionality
- # should be moved anyway...
- def register(name=Chef::Config[:node_name], destination=Chef::Config[:client_key])
- if (File.exists?(destination) && !File.writable?(destination))
- raise Chef::Exceptions::CannotWritePrivateKey, "I cannot write your private key to #{destination} - check permissions?"
- end
- nc = Chef::ApiClient.new
- nc.name(name)
-
- catch(:done) do
- retries = config[:client_registration_retries] || 5
- 0.upto(retries) do |n|
- begin
- response = nc.save(true, true)
- Chef::Log.debug("Registration response: #{response.inspect}")
- raise Chef::Exceptions::CannotWritePrivateKey, "The response from the server did not include a private key!" unless response.has_key?("private_key")
- # Write out the private key
- ::File.open(destination, "w") {|f|
- f.chmod(0600)
- f.print(response["private_key"])
- }
- throw :done
- rescue IOError
- raise Chef::Exceptions::CannotWritePrivateKey, "I cannot write your private key to #{destination}"
- rescue Net::HTTPFatalError => e
- Chef::Log.warn("Failed attempt #{n} of #{retries+1} on client creation")
- raise unless e.response.code == "500"
- end
- end
- end
-
- true
- end
-
# Send an HTTP GET request to the path
#
# Using this method to +fetch+ a file is considered deprecated.