我想第二個拷貝http://seapower/spring.txt和http://seapower/has_sprung.txt並追加到第一個在名爲src_filepath.txt新文件:有兩種資源,在廚師添加一個到另一個remote_file
remote_file 'src_filepath.txt' do
source 'http://seapower/spring.txt', 'http://seapower/has_sprung.txt'
checksum node['nginx']['foo123']['checksum']
owner 'root'
group 'root'
mode '0755'
end
它不起作用,只是將第一個文件複製到src_filepath.txt
幾乎總是錯誤的想法廚師代碼使用'網:: HTTP'。你應該使用'Chef :: HTTP'來代替。 – coderanger
是啊這個答案相當複雜。最好使用兩個remote_file資源下載到Chef :: Config [:file_cache_path]並依靠廚師的冪等性在每次運行時不重新下載。然後構建一個文件資源,其中內容將IO.read連接到remote_fille資源使用的路徑名。 – lamont
關於它被捲入錯誤(雖然我認爲請求是一個相當具體的請求),但爲什麼調用'IO.read'比調用'Net :: HTTP'(或者'Chef :: HTTP'> )? –