/usr/lib/ruby/vendor_ruby/berkshelf/api/endpoint/v1.rb is in berkshelf-api 2.2.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | module Berkshelf::API
module Endpoint
class V1 < Endpoint::Base
helpers Berkshelf::API::Mixin::Services
version 'v1', using: :header, vendor: 'berkshelf'
default_format :json
rescue_from Grape::Exceptions::Validation do |e|
body = JSON.generate({status: e.status, message: e.message, param: e.param})
rack_response(body, e.status, "Content-type" => "application/json")
end
desc "list all known cookbooks"
get 'universe' do
if cache_manager.warmed?
cache_manager.cache
else
header "Retry-After", 600
status 503
end
end
desc "health check"
get 'status' do
{
status: 'ok',
version: Berkshelf::API::VERSION,
cache_status: cache_manager.warmed? ? 'ok' : 'warming',
uptime: Time.now.utc - Application.start_time,
}
end
end
end
end
|