Method: Chef::ApiClient::Registration#create_or_update

Defined in:
lib/chef/api_client/registration.rb

#create_or_updateObject



95
96
97
98
99
100
101
102
103
# File 'lib/chef/api_client/registration.rb', line 95

def create_or_update
  create
rescue Net::HTTPClientException => e
  # If create fails because the client exists, attempt to update. This
  # requires admin privileges.
  raise unless e.response.code == "409"

  update
end