1
我試圖用廚師執行資源廚師執行資源的錯誤,同時運行成功
execute "unzipping_webapp" do
cwd "#{node[:config][:repo_dir]}"
command <<-EOF
unzip -o #{node[:config][:webapp_name]}
EOF
end
要解壓的文件也試過
execute "unzipping webapp" do
command "unzip -o #{node[:config][:webapp_name]}"
cwd "#{node[:config][:repo_dir]}"
end
我得到了如下的錯誤
================================================================================
Error executing action `run` on resource 'execute[unzipping_webapp]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of unzip -o webapp.zip
----
STDOUT: Archive: webapp.zip
warning: skipped "../" path component(s) in ../webapp/
creating: webapp/
warning: skipped "../" path component(s) in ../webapp/bower.json
inflating: webapp/bower.json
warning: skipped "../" path component(s) in ../webapp/bower_components/
creating: webapp/bower_components/
warning: skipped "../" path component(s) in ../webapp/bower_components/bootstrap/.bower.json
inflating: webapp/bower_components/bootstrap/.bower.json
warning: skipped "../" path component(s) in ../webapp/bower_components/bootstrap/bower.json
inflating: webapp/bower_components/bootstrap/bower.json
.
.More files
.
warning: skipped "../" path component(s) in ../webapp/js/
creating: webapp/js/
warning: skipped "../" path component(s) in ../webapp/js/app.js
extracting: webapp/js/app.js
STDERR:
---- End output of unzip -o webapp.zip
----
Ran unzip -o webapp.zip
returned 1
當我檢查系統時,文件已成功解壓縮。
我不明白爲什麼我的廚師運行失敗,而正確執行的東西。
有沒有人遇到過這個問題或有解決辦法嗎?
當我試圖使用命令行直接解壓縮實例時,它工作正常。當我與廚師一起運行時,它是失敗的 –
當你說「工作正常」時,你是否真的在檢查'$?'以確保它是0? – coderanger
是的,你是對的。它給出了1.還有poise-archive食譜做的工作。謝謝 ! –