2012-05-20 75 views
8

我想通過Ubuntu 12.04服務器上的opscode食譜安裝nginx。我知道這取決於ohai,所以我也下載了食譜。當我運行廚師獨奏錯誤Errno :: ENOENT:沒有這樣的文件或目錄 - solo.rb

$ sudo chef-solo -c solo.rb 

我得到一個錯誤說

FATAL: Errno::ENOENT: No such file or directory - solo.rb 

不知道如何當它在我的當前目錄solo.rb丟失。

$ ls 
cache cookbooks node.json node.json~ solo.rb solo.rb~ 

下面是調試輸出

$ sudo chef-solo -l debug -c solo.rb 
[Sun, 20 May 2012 14:00:10 -0400] INFO: *** Chef 0.10.10 *** 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Building node object for vagrant-ubuntu-precise 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Extracting run list from JSON attributes provided on command line 
[Sun, 20 May 2012 14:00:10 -0400] INFO: Setting the run_list to ["recipe[ohai]", "recipe[main]", "recipe[nginx]"] from JSON 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Applying attributes from json file 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Platform is ubuntu version 12.04 
[Sun, 20 May 2012 14:00:10 -0400] INFO: Run List is [recipe[ohai], recipe[main], recipe[nginx]] 
[Sun, 20 May 2012 14:00:10 -0400] INFO: Run List expands to [ohai, main, nginx] 
[Sun, 20 May 2012 14:00:10 -0400] INFO: Starting Chef Run for vagrant-ubuntu-precise 
[Sun, 20 May 2012 14:00:10 -0400] INFO: Running start handlers 
[Sun, 20 May 2012 14:00:10 -0400] INFO: Start handlers complete. 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: No chefignore file found at /var/chef/cookbooks/chefignore no files will be ignored 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loading cookbook chef-jenkins's library file: /var/chef/cookbooks/chef-jenkins/libraries/manage_node.rb 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loading cookbook chef-jenkins's providers from /var/chef/cookbooks/chef-jenkins/providers/job.rb 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loaded contents of /var/chef/cookbooks/chef-jenkins/providers/job.rb into a provider named chef-jenkins_job defined in Chef::Provider::ChefJenkinsJob 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loading cookbook chef-jenkins's providers from /var/chef/cookbooks/chef-jenkins/providers/execute.rb 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loaded contents of /var/chef/cookbooks/chef-jenkins/providers/execute.rb into a provider named chef-jenkins_execute defined in Chef::Provider::ChefJenkinsExecute 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loading cookbook chef-jenkins's providers from /var/chef/cookbooks/chef-jenkins/providers/node.rb 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loaded contents of /var/chef/cookbooks/chef-jenkins/providers/node.rb into a provider named chef-jenkins_node defined in Chef::Provider::ChefJenkinsNode 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loading cookbook chef-jenkins's providers from /var/chef/cookbooks/chef-jenkins/providers/cli.rb 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loaded contents of /var/chef/cookbooks/chef-jenkins/providers/cli.rb into a provider named chef-jenkins_cli defined in Chef::Provider::ChefJenkinsCli 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loading cookbook chef-jenkins's resources from /var/chef/cookbooks/chef-jenkins/resources/job.rb 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loaded contents of /var/chef/cookbooks/chef-jenkins/resources/job.rb into a resource named chef-jenkins_job defined in Chef::Resource::ChefJenkinsJob 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loading cookbook chef-jenkins's resources from /var/chef/cookbooks/chef-jenkins/resources/node.rb 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loaded contents of /var/chef/cookbooks/chef-jenkins/resources/node.rb into a resource named chef-jenkins_node defined in Chef::Resource::ChefJenkinsNode 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loading cookbook chef-jenkins's resources from /var/chef/cookbooks/chef-jenkins/resources/execute.rb 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loaded contents of /var/chef/cookbooks/chef-jenkins/resources/execute.rb into a resource named chef-jenkins_execute defined in Chef::Resource::ChefJenkinsExecute 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loading cookbook chef-jenkins's resources from /var/chef/cookbooks/chef-jenkins/resources/cli.rb 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loaded contents of /var/chef/cookbooks/chef-jenkins/resources/cli.rb into a resource named chef-jenkins_cli defined in Chef::Resource::ChefJenkinsCli 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Node vagrant-ubuntu-precise loading cookbook nginx's attribute file /var/chef/cookbooks/nginx/attributes/default.rb 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Node vagrant-ubuntu-precise loading cookbook nginx's attribute file /var/chef/cookbooks/nginx/attributes/geoip.rb 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Node vagrant-ubuntu-precise loading cookbook nginx's attribute file /var/chef/cookbooks/nginx/attributes/source.rb 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Node vagrant-ubuntu-precise loading cookbook nginx's attribute file /var/chef/cookbooks/nginx/attributes/upload_progress.rb 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Node vagrant-ubuntu-precise loading cookbook ohai's attribute file /var/chef/cookbooks/ohai/attributes/default.rb 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Node vagrant-ubuntu-precise loading cookbook chef-jenkins's attribute file /var/chef/cookbooks/chef-jenkins/attributes/default.rb 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loading cookbook nginx's definitions from /var/chef/cookbooks/nginx/definitions/nginx_site.rb 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loading Recipe ohai via include_recipe 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Found recipe default in cookbook ohai 
[Sun, 20 May 2012 14:00:10 -0400] INFO: ohai plugins will be at: /etc/chef/ohai_plugins 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Platform ubuntu not found, using all defaults. (Unsupported platform?) 
[Sun, 20 May 2012 14:00:10 -0400] INFO: Processing remote_directory[/etc/chef/ohai_plugins] action create (ohai::default line 23) 
[Sun, 20 May 2012 14:00:10 -0400] INFO: Processing cookbook_file[/etc/chef/ohai_plugins/README] action create (dynamically defined) 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Platform ubuntu not found, using all defaults. (Unsupported platform?) 
[Sun, 20 May 2012 14:00:10 -0400] ERROR: Running exception handlers 
[Sun, 20 May 2012 14:00:10 -0400] ERROR: Exception handlers complete 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Re-raising exception: Errno::ENOENT - No such file or directory - solo.rb 
/var/chef/cookbooks/ohai/recipes/default.rb:41:in `read' 
/var/chef/cookbooks/ohai/recipes/default.rb:41:in `from_file' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/cookbook_version.rb:578:in `load_recipe' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/mixin/language_include_recipe.rb:46:in `load_recipe' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/mixin/language_include_recipe.rb:33:in `include_recipe' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/mixin/language_include_recipe.rb:27:in `each' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/mixin/language_include_recipe.rb:27:in `include_recipe' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/run_context.rb:72:in `load' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/run_context.rb:69:in `each' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/run_context.rb:69:in `load' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/client.rb:199:in `setup_run_context' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/client.rb:162:in `run' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/application/solo.rb:207:in `run_application' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/application/solo.rb:195:in `loop' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/application/solo.rb:195:in `run_application' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/application.rb:70:in `run' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/chef-solo:25 
/usr/local/bin/chef-solo:19:in `load' 
/usr/local/bin/chef-solo:19 
[Sun, 20 May 2012 14:00:10 -0400] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out 
[Sun, 20 May 2012 14:00:10 -0400] DEBUG: Errno::ENOENT: No such file or directory - solo.rb 
/var/chef/cookbooks/ohai/recipes/default.rb:41:in `read' 
/var/chef/cookbooks/ohai/recipes/default.rb:41:in `from_file' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/cookbook_version.rb:578:in `load_recipe' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/mixin/language_include_recipe.rb:46:in `load_recipe' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/mixin/language_include_recipe.rb:33:in `include_recipe' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/mixin/language_include_recipe.rb:27:in `each' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/mixin/language_include_recipe.rb:27:in `include_recipe' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/run_context.rb:72:in `load' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/run_context.rb:69:in `each' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/run_context.rb:69:in `load' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/client.rb:199:in `setup_run_context' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/client.rb:162:in `run' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/application/solo.rb:207:in `run_application' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/application/solo.rb:195:in `loop' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/application/solo.rb:195:in `run_application' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/application.rb:70:in `run' 
/var/lib/gems/1.8/gems/chef-0.10.10/bin/chef-solo:25 
/usr/local/bin/chef-solo:19:in `load' 
/usr/local/bin/chef-solo:19 
[Sun, 20 May 2012 14:00:10 -0400] FATAL: Errno::ENOENT: No such file or directory - solo.rb 
+0

嘗試使用./solo.rb而不是像/home/ubuntu/solo.rb這樣的完整方式。 –

+0

試過了,它沒有工作。我得到了完全相同的輸出。 – Brandon

+0

不知道。嘗試'sudo su -',然後嘗試沒有sudo的'chief-solo'命令。 –

回答

15

這是由於廚師的作品。它將目錄更改爲/以避免任何類型的權限問題,但這意味着需要訪問命令行參數的插件不會再知道如何訪問相對路徑。

廚師代碼存在一個錯誤來解決這個問題。

現在,使用完整路徑爲您的chef-solo參數解決了問題。例如。

$ chef-solo -c /full/path/to/solo.rb -j /full/path/to/node.json -l debug 

或者爲別人指出,去除/etc/chef/ohai_plugins/README文件也將「修復」的問題。雖然不是真正的方式,因爲所做的只是在ohai_plugins文件夾上觸發修改時間更新,觸發廚師重新加載所有內容。該功能無法保證,並可能在上述錯誤得到解決之前破壞。

0

如果廚師獨奏0.10.10找不到你solo.rb它會與你的調試日誌的開頭以下消息抱怨:

$ chef-solo -c solo.rb -l debug 
[2012-06-18T23:27:32+03:00] WARN: ***************************************** 
[2012-06-18T23:27:32+03:00] WARN: Did not find config file: solo.rb, using command line options. 
[2012-06-18T23:27:32+03:00] WARN: ***************************************** 
[2012-06-18T23:27:32+03:00] INFO: *** Chef 0.10.10 *** 
... 

所以這個錯誤是以某種方式使用這個配置文件名的配方邏輯。

2

最可能的問題是每次運行時重新創建的「/ etc/chef/ohai_plugins/README」。在運行廚師獨奏之前,您只需刪除它。

相關問題