如何在chef中使用python解释器

如何在chef中使用python解释器,python,chef-infra,Python,Chef Infra,我正在尝试在chef中使用python解释器。下面是我天真的尝试,但没有成功。用python完成以下任务的正确方法是什么 script "install_something" do interpreter "python" user "root" cwd "/tmp" code <<-EOH import boto f = open('test.txt','r') f.write('adfadf') f.close() EOH not_if {

我正在尝试在chef中使用python解释器。下面是我天真的尝试,但没有成功。用python完成以下任务的正确方法是什么

script "install_something" do
  interpreter "python"
  user "root"
  cwd "/tmp"
  code <<-EOH
  import boto
  f = open('test.txt','r')
  f.write('adfadf')
  f.close()
  EOH
  not_if {File.exists?("/tmp/test.txt")}
end


[Mon, 02 Apr 2012 15:20:35 +0000] ERROR: Chef::Exceptions::ShellCommandFailed: script[install_something] (rtb_server::default line 101) had an error: Chef::Exceptions::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of "python"  "/tmp/chef-script20120402-26069-3d6hob-0" ----
STDOUT: 
STDERR: File "/tmp/chef-script20120402-26069-3d6hob-0", line 1
    import boto
    ^
IndentationError: unexpected indent
---- End output of "python"  "/tmp/chef-script20120402-26069-3d6hob-0" ----
Ran "python"  "/tmp/chef-script20120402-26069-3d6hob-0" returned 1
script“install\u something”执行
解释器“python”
用户“根”
cwd“/tmp”
代码

  code <<-EOH
  import boto
  f = open('test.txt','r')
  f.write('adfadf')
  f.close()
  EOH
code