diff options
author | danielsdeleo <dan@opscode.com> | 2012-12-18 17:07:56 -0800 |
---|---|---|
committer | danielsdeleo <dan@opscode.com> | 2012-12-18 17:10:05 -0800 |
commit | d737f867d71d193081f6a7cffe1ae5665d6bb983 (patch) | |
tree | fb226fa78f4289a072cb6c775a312f6addcb9de7 /lib/chef/api_client.rb | |
parent | 10b457a41b27a71168c5f86b1bb47c72c44833bc (diff) | |
download | chef-d737f867d71d193081f6a7cffe1ae5665d6bb983.tar.gz |
[CHEF-3689] remove extra flags to Client#save
Diffstat (limited to 'lib/chef/api_client.rb')
-rw-r--r-- | lib/chef/api_client.rb | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/lib/chef/api_client.rb b/lib/chef/api_client.rb index 6c7132d28f..32e1eee017 100644 --- a/lib/chef/api_client.rb +++ b/lib/chef/api_client.rb @@ -158,19 +158,13 @@ class Chef end # Save this client via the REST API, returns a hash including the private key - def save(new_key=false, validation=false) - if validation - r = http_api_as_validator - else - r = http_api - end - # First, try and create a new registration + def save begin - r.post("clients", {:name => self.name, :admin => self.admin }) + http_api.put("clients/#{name}", { :name => self.name, :admin => self.admin}) rescue Net::HTTPServerException => e # If that fails, go ahead and try and update it - if e.response.code == "409" - r.put("clients/#{name}", { :name => self.name, :admin => self.admin, :private_key => new_key }) + if e.response.code == "404" + http_api.post("clients", {:name => self.name, :admin => self.admin }) else raise e end |