Add a 'status' path

This commit is contained in:
Scott Schneider 2013-11-01 13:41:11 -07:00
parent 0c187a5486
commit 026a4a459c

View file

@ -26,6 +26,21 @@ get '/' do
puts '' puts ''
end end
get '/status' do
content_type :json
result = {}
pools.each do |pool|
result[pool['name']] = {}
[ 'pending', 'ready', 'completed' ].each do |queue|
result[pool['name']][queue] = $redis.scard("vmware_host_pool__#{queue}__#{pool['name']}")
end
end
JSON.pretty_generate(result)
end
get '/vm/:template' do get '/vm/:template' do
content_type :json content_type :json