Project

General

Profile

Download (506 Bytes) Statistics
| Branch: | Tag: | Revision:
class SmartProxy < Sinatra::Base
get "/facts" do
begin
content_type :json
Facter.clear
Facter.to_hash.to_json
rescue => e
log_halt 400, e
end
end

get "/facts/:fact" do
begin
content_type :json
Facter.clear
fact_value = Facter.fact(params[:fact].to_sym).value
log_halt 404, "Fact #{params[:fact]} not found" unless fact_value
{ params[:fact].to_sym => fact_value }.to_json
rescue => e
log_halt 400, e
end
end

end
(7-7/16)