Chef infra 在另一台服务器上使用chef http_请求方法发布测试文件

Chef infra 在另一台服务器上使用chef http_请求方法发布测试文件,chef-infra,chef-recipe,Chef Infra,Chef Recipe,我想使用chef http_请求方法在服务器上发布一个文本文件。 在这里我写了一些东西,但它不起作用- http_request "post a file" do action :post url "http://<server_ip>/php/upload.php" headers "Content-Type" => "text/plain" message ::File.read("#{filename}") end http\u请求“发布文件”吗 行动:

我想使用chef http_请求方法在服务器上发布一个文本文件。 在这里我写了一些东西,但它不起作用-

http_request "post a file" do
  action :post
  url "http://<server_ip>/php/upload.php"
  headers "Content-Type" => "text/plain"
  message ::File.read("#{filename}")
end
http\u请求“发布文件”吗
行动:员额
url“http:///php/upload.php"
标题“内容类型”=>“文本/普通”
message::File.read(“#{filename}”)
结束

有人能建议我怎么做吗?

文件上传,听起来像你在尝试这么做,需要比
HTTP\u请求
实现更复杂的HTTP机制。您必须使用
ruby_块
和类似法拉第或
Chef::HTTP的东西自己来做