summaryrefslogtreecommitdiff
path: root/chef-server-api
diff options
context:
space:
mode:
authorsdelano <stephen@opscode.com>2010-09-02 14:02:07 -0700
committerSeth Falcon <seth@opscode.com>2010-11-01 10:46:58 -0700
commite9c7c8a14bd774e24e9987e16652f187bc19f10d (patch)
tree4640636ebfcbc9b804bf35743ca1c1652014bd6f /chef-server-api
parent6e1882492a2286d0cc24d52f8515eb1ef7e49ad5 (diff)
downloadchef-e9c7c8a14bd774e24e9987e16652f187bc19f10d.tar.gz
return all cookbooks available for an environment
Diffstat (limited to 'chef-server-api')
-rw-r--r--chef-server-api/app/controllers/environments.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/chef-server-api/app/controllers/environments.rb b/chef-server-api/app/controllers/environments.rb
index 8dceee7ef7..96d9cdd891 100644
--- a/chef-server-api/app/controllers/environments.rb
+++ b/chef-server-api/app/controllers/environments.rb
@@ -93,7 +93,14 @@ class Environments < Application
rescue Chef::Exceptions::CouchDBNotFound
raise NotFound, "Cannot load environment #{params[:environment_id]}"
end
- display(filtered_cookbooks.inject({}) {|res, (k,v)| res[v.name] = absolute_url(:cookbook_version, :cookbook_name=>v.name, :cookbook_version=>v.version); res})
+ display(filtered_cookbooks.inject({}) {|res, (cookbook_name,versions)|
+ # TODO:
+ # For now, we are only displaying the last cookbook in the sorted list (the newest version).
+ # We should display every cookbook version that is available in a given environment
+ # [stephen 9/2/10]
+ res[cookbook_name] = absolute_url(:cookbook_version, :cookbook_name=>cookbook_name, :cookbook_version=>versions.last.version)
+ res
+ })
end
# GET /environments/:environment_id/nodes