Reputation: 757
wI'm exploring the Rest api of Chef for project purposes. I'm able to get, post and delete node/node-data. But I'm not able to execute PUT request, i.e. update the node related data on the server. Here is the screen shot of the error i get.
Following is the code that is making the request. I have specified the authentication parameters properly, and they are working properly.
rest = Chef::REST.new(server_url, client_name, signing_key_filename)
print "Enter the node you want to edit :\n"
editnode = gets.chomp
node = rest.get_rest("/nodes/#{editnode}")
print "#{node.name}\n"
print "\t#{node.run_list}\n"
print "Now updating the node as per the parameters specified :\n"
update_node = {
"run_list" => "recipe[123]"
}
rest.put_rest("nodes/#{editnode}","update_node")
Please suggest some solution.
Upvotes: 1
Views: 1496
Reputation: 54211
So two issues:
"update_node"
in the put_rest so you are sending that back as a literal, when the server expects a hash.Upvotes: 3