我正在为项目目的探索Chef的Rest api。我能够获取,发布和删除节点/节点数据。但是我无法执行PUT请求,即更新服务器上的节点相关数据。这是我得到的错误的屏幕截图。
以下是发出请求的代码。我已正确指定了身份验证参数,并且它们正常运行。
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")
请提出一些解决方案。
答案 0 :(得分:3)
所以有两个问题:
"update_node"
,因此当服务器需要哈希时,你将它作为文字发回。