Method: Chef::Node#create
- Defined in:
- lib/chef/node.rb
#create ⇒ Object
Create the node via the REST API
682 683 684 685 686 687 688 689 690 691 692 693 694 |
# File 'lib/chef/node.rb', line 682 def create chef_server_rest.post("nodes", data_for_save) self rescue Net::HTTPClientException => e # Chef Server before 12.3 rejects node JSON with 'policy_name' or # 'policy_group' keys, but 'policy_name' will be detected first. # Backcompat can be removed in 13.0 if e.response.code == "400" && e.response.body.include?("Invalid key policy_name") chef_server_rest.post("nodes", data_for_save_without_policyfile_attrs) else raise end end |