2014-12-07 28 views
1

相反的文檔......在我solo.rb文件下的不工作:廚師獨奏和cookbook_path:多路徑不沃金

root = File.absolute_path(File.dirname(__FILE__)) 
cookbook_path [ root + "/cookbooks",root + "/site-cookbooks", root + "/berks-cookbooks" ] 

這工作,但失敗的目的,因爲我需要在食譜添加路徑的另外兩個迪爾斯:

root = File.absolute_path(File.dirname(__FILE__)) 
cookbook_path root + "/cookbooks" 

下面是一個示例作用

{ 
    "name": "coordinator_do_server", 
    "environment":{"git_repos":[]}, 
    "java":{ "install_flavor":"oracle","jdk_version":"7"}, 
    "run_list": ["recipe[build-essential]" 
    ] 
} 

錯誤我得到的是如下:

Starting Chef Client, version 11.14.2 

================================================================================ 
Error expanding the run_list: 
================================================================================ 

Unexpected Error: 
----------------- 
TypeError: can't convert Array into String 

[2014-12-07T18:22:07+08:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out 
Chef Client failed. 0 resources updated in 2.259210544 seconds 
[2014-12-07T18:22:07+08:00] ERROR: can't convert Array into String 
[2014-12-07T18:22:07+08:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1) 

我該如何解決?

Generated at 2014-12-08 00:12:42 +0800 
TypeError: can't convert Array into String 
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.14.2/lib/chef/environment.rb:248:in `directory?' 
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.14.2/lib/chef/environment.rb:248:in `load_from_file' 
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.14.2/lib/chef/environment.rb:241:in `load' 
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.14.2/lib/chef/node.rb:380:in `apply_expansion_attributes' 
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.14.2/lib/chef/node.rb:369:in `expand!' 
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.14.2/lib/chef/policy_builder/expand_node_object.rb:135:in `expand_run_list' 
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.14.2/lib/chef/policy_builder/expand_node_object.rb:122:in `build_node' 
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.14.2/lib/chef/client.rb:259:in `build_node' 
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.14.2/lib/chef/client.rb:420:in `do_run' 
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.14.2/lib/chef/client.rb:213:in `block in run' 
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.14.2/lib/chef/client.rb:207:in `fork' 
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.14.2/lib/chef/client.rb:207:in `run' 
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.14.2/lib/chef/application.rb:237:in `run_chef_client' 
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.14.2/lib/chef/application/solo.rb:226:in `block in run_application' 
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.14.2/lib/chef/application/solo.rb:218:in `loop' 
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.14.2/lib/chef/application/solo.rb:218:in `run_application' 
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.14.2/lib/chef/application.rb:55:in `run' 
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.14.2/bin/chef-solo:25:in `<top (required)>' 
/usr/local/bin/chef-solo:23:in `load' 
/usr/local/bin/chef-solo:23:in `<main>' 

回答

1

的問題是,chef_repo_path派生從的cookbook_path它的默認值,然後默認environment_path基於chef_repo_path。要解決此問題,請將chef_repo_path root添加到您的配置中。