Class: ChefServerSlice::CookbookRecipes
- Inherits:
-
Application
- Object
- Merb::Controller
- Application
- ChefServerSlice::CookbookRecipes
show all
- Includes:
- Chef::Mixin::Checksum
- Defined in:
- app/controllers/cookbook_recipes.rb
Instance Method Summary
collapse
Methods inherited from Application
#absolute_slice_url, #access_denied, #authorized_node, #escape_node_id, #expand_cookbook_deps, #fix_up_node_id, #get_available_recipes, #load_all_files, #load_cookbook_segment, #login_required, #redirect_back_or_default, #segment_files, #specific_cookbooks, #store_location
Instance Method Details
#index ⇒ Object
33
34
35
36
37
38
39
40
|
# File 'app/controllers/cookbook_recipes.rb', line 33
def index
if params[:id]
show
else
load_cookbook_recipes()
display @recipe_files
end
end
|
#load_cookbook_recipes ⇒ Object
29
30
31
|
# File 'app/controllers/cookbook_recipes.rb', line 29
def load_cookbook_recipes()
@recipe_files = load_cookbook_segment(params[:cookbook_id], :recipes)
end
|
#show ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'app/controllers/cookbook_recipes.rb', line 42
def show
only_provides :json
load_cookbook_recipes
raise NotFound, "Cannot find a suitable recipe file!" unless @recipe_files.has_key?(params[:id])
to_send = @recipe_files[params[:id]][:file]
current_checksum = checksum(to_send)
Chef::Log.debug("old sum: #{params[:checksum]}, new sum: #{current_checksum}")
if current_checksum == params[:checksum]
display "File #{to_send} has not changed", :status => 304
else
send_file(to_send)
end
end
|