33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/chef/knife/solve.rb', line 33
def run
environment = config[:environment]
cookbooks = name_args
if config[:node]
node = Chef::Node.load(config[:node])
environment ||= node.chef_environment
cookbooks += node.run_list.run_list_items
end
environment ||= '_default'
cookbooks = cookbooks.map do |arg|
arg = arg.to_s
if arg.include?('[')
run_list = [Chef::RunList::RunListItem.new(arg)]
expansion = Chef::RunList::RunListExpansionFromAPI.new(environment, run_list, rest)
expansion.expand
expansion.recipes
else
arg end
end.flatten.map do |arg|
arg.split('@').first.split('::').first
end
ui.info("Solving [#{cookbooks.join(', ')}] in #{environment} environment")
solution = solve_cookbooks(environment, cookbooks)
solution.sort.each do |name, cb|
msg("#{name} #{cb.version}")
end
end
|