"chef provision" and other cookbooks

Hi all,

How does one include other cookbooks from within the “chef provision” recipe?

provision.rb has:

  def chef_runner
    @chef_runner ||= ChefRunner.new(provisioning_cookbook_path, ["recipe[#{provisioning_cookbook_name}::#{recipe}]"])
  end

which to me suggests that provisioning_cookbook_path is the only cookbook available.

I tried the following from the recipe:

%w(database postgresql).each do |book|
  cl = Chef::Cookbook::CookbookVersionLoader.new("#{ENV['HOME']}/git/chef-repo/cookbooks/#{book}")
  cl.load!
  cookbook = cl.cookbook_version
  run_context.cookbook_collection[book] = cookbook
end

which seems to work for those cookbooks, but is really cumbersome and requires all the dependencies to be available locally.

(I also tried adding “depends” lines to provision’s metadata.rb, but that didn’t work either (can’t find cookbook even though it’s present).)

Surely there’s a better way?

Thanks,
Jos