我是紅寶石和廚師的新手。我試圖通過模板資源創建一個文件。運行chef-apply命令後,出現「NoMethodError:未定義方法`preferred_filename_on_disk_location'爲nil:NilClass」的錯誤。我試圖谷歌它,但沒有找到正確的解決方案。NoMethodError:未定義方法`preferred_filename_on_disk_location'爲零:NilClass
請幫忙。
廚師申請abc.rb
配方:(廚師申請食譜)::(廚師申請配方) *模板[file.txt的]操作創建
================================================================================
Error executing action `create` on resource 'template[file.txt]'
================================================================================
NoMethodError
-------------
undefined method `preferred_filename_on_disk_location' for nil:NilClass
Resource Declaration:
---------------------
# In abc.rb
10: template "file.txt" do
11: source "file.erb"
12: mode "0666"
13: end
14:
Compiled Resource:
#在聲明abc.rb:10:在`run_chef_recipe」
template("file.txt") do
action [:create]
retries 0
retry_delay 2
default_guard_interpreter :default
source "file.erb"
declared_type :template
cookbook_name "(chef-apply cookbook)"
recipe_name "(chef-apply recipe)"
mode "0666"
path "file.txt"
end
Platform:
---------
x86_64-linux
[2017-01-02T18:37:07-05:00]致命:堆棧跟蹤轉儲到/var/chef/cache/chef-stacktrace.out [2017-01-02T18:37:07-0 5:00]致命錯誤:如果提交錯誤報告 [2017-01-02T18:37:07-05:00],請提供stacktrace.out文件的內容致命錯誤:NoMethodError:template [file.txt](( (主廚申請食譜)第10行)有一個錯誤:NoMethodError:未定義方法`preferred_filename_on_disk_location'爲零:NilClass
歡迎來到StackOverflow。請嘗試修復您問題的格式 - 如果您的代碼和錯誤消息格式正確,將會更容易地爲您提供幫助。 –
請看[ask]和[mcve] –