Report ok = 'false' if API DELETE fails

This commit is contained in:
Scott Schneider 2014-02-06 09:40:57 -08:00
parent b05311193f
commit c93ab9075d

View file

@ -55,7 +55,7 @@ get '/dashboard/stats/vcloud/numbers' do
result['total'] = result['pending'].to_i + result['ready'].to_i + result['running'].to_i + result['completed'].to_i result['total'] = result['pending'].to_i + result['ready'].to_i + result['running'].to_i + result['completed'].to_i
content_type :json content_type :json
JSON.pretty_generate( result ) JSON.pretty_generate(result)
end end
get '/dashboard/stats/vcloud/pool' do get '/dashboard/stats/vcloud/pool' do
@ -107,7 +107,7 @@ get '/dashboard/stats/vcloud/pool' do
end end
content_type :json content_type :json
JSON.pretty_generate( result ) JSON.pretty_generate(result)
end end
get '/status' do get '/status' do
@ -174,10 +174,12 @@ delete '/vm/:hostname' do
if $redis.sismember('vmware_host_pool__running__'+pool['name'], params[:hostname]) if $redis.sismember('vmware_host_pool__running__'+pool['name'], params[:hostname])
$redis.srem('vmware_host_pool__running__'+pool['name'], params[:hostname]) $redis.srem('vmware_host_pool__running__'+pool['name'], params[:hostname])
$redis.sadd('vmware_host_pool__completed__'+pool['name'], params[:hostname]) $redis.sadd('vmware_host_pool__completed__'+pool['name'], params[:hostname])
result['ok'] = true
else
result['ok'] = false
end end
end end
result['ok'] = true
JSON.pretty_generate(result) JSON.pretty_generate(result)
end end