summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Keiser <john@johnkeiser.com>2013-04-28 13:27:32 -0700
committerJohn Keiser <john@johnkeiser.com>2013-04-28 13:27:32 -0700
commitd9ec28aa4b5c87c1c11cd81c45a99868ad06b20d (patch)
tree09d73cbfc5925e88c89b7d057da8241069ee9f6d
parentbae86330a3a93b793cff65a8200d51f192adc0e7 (diff)
downloadchef-zero-d9ec28aa4b5c87c1c11cd81c45a99868ad06b20d.tar.gz
Support runlists with recipes, not just cookbooks
-rw-r--r--lib/chef_zero/endpoints/environment_cookbook_versions_endpoint.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/chef_zero/endpoints/environment_cookbook_versions_endpoint.rb b/lib/chef_zero/endpoints/environment_cookbook_versions_endpoint.rb
index 7323565..6efa9a0 100644
--- a/lib/chef_zero/endpoints/environment_cookbook_versions_endpoint.rb
+++ b/lib/chef_zero/endpoints/environment_cookbook_versions_endpoint.rb
@@ -22,13 +22,14 @@ module ChefZero
desired_versions = {}
run_list = JSON.parse(request.body, :create_additions => false)['run_list']
run_list.each do |run_list_entry|
- if run_list_entry =~ /(.+)\@(.+)/
+ if run_list_entry =~ /(.+)(::.+)?\@(.+)/
raise RestErrorResponse.new(412, "No such cookbook: #{$1}") if !cookbooks[$1]
raise RestErrorResponse.new(412, "No such cookbook version for cookbook #{$1}: #{$2}") if !cookbooks[$1][$2]
- desired_versions[$1] = [ $2 ]
+ desired_versions[$1] = [ $3 ]
else
- raise RestErrorResponse.new(412, "No such cookbook: #{run_list_entry}") if !cookbooks[run_list_entry]
- desired_versions[run_list_entry] = cookbooks[run_list_entry].keys
+ desired_cookbook = run_list_entry.split('::')[0]
+ raise RestErrorResponse.new(412, "No such cookbook: #{desired_cookbook}") if !cookbooks[desired_cookbook]
+ desired_versions[desired_cookbook] = cookbooks[desired_cookbook].keys
end
end