11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/monkey_patches/chef/client.rb', line 11
def setup_run_context
if Chef::Config[:solo]
if Chef::Config[:use_berkshelf]
cookbook_collection = run_berks
else
Chef::Cookbook::FileVendor.on_create { |manifest| Chef::Cookbook::FileSystemFileVendor.new(manifest, Chef::Config[:cookbook_path]) }
cl = Chef::CookbookLoader.new(Chef::Config[:cookbook_path])
cl.load_cookbooks
cookbook_collection = Chef::CookbookCollection.new(cl)
end
run_context = Chef::RunContext.new(node, cookbook_collection, @events)
else
if Chef::Config[:use_berkshelf]
cookbook_collection = run_berks
else
Chef::Cookbook::FileVendor.on_create { |manifest| Chef::Cookbook::RemoteFileVendor.new(manifest, rest) }
cookbook_hash = sync_cookbooks
cookbook_collection = Chef::CookbookCollection.new(cookbook_hash)
end
run_context = Chef::RunContext.new(node, cookbook_collection, @events)
end
run_status.run_context = run_context
run_context.load(@run_list_expansion)
assert_cookbook_path_not_empty(run_context)
run_context
end
|