场景:
在recipe1/recipes/default.rb中:
.. do work
node[:recipe1][:filePath] = ".." #path to file
Run Code Online (Sandbox Code Playgroud)
在recipe2/recipes/default.rb中:
require node[:recipe1][:filePath]/lib/Library
.. do work
Run Code Online (Sandbox Code Playgroud)
但是,在加载食谱时,厨师宣布:
[Wed, 17 Aug 2011 19:32:23 +0800] DEBUG: Loading cookbook apache2's definitions from /var/chef/cookbooks/apache2/definitions/web_app.rb
[Wed, 17 Aug 2011 19:32:23 +0800] DEBUG: Loading cookbook apache2's definitions from /var/chef/cookbooks/apache2/definitions/apache_module.rb
[Wed, 17 Aug 2011 19:32:23 +0800] DEBUG: Loading Recipe Recipe1 via include_recipe
[Wed, 17 Aug 2011 19:32:23 +0800] DEBUG: Found recipe default in cookbook Recipe1
[Wed, 17 Aug 2011 19:32:23 +0800] ERROR: Running …Run Code Online (Sandbox Code Playgroud)