Report ok = 'false' if API DELETE fails

This commit is contained in:
Scott Schneider 2014-02-06 09:59:21 -08:00
parent 08559b2d75
commit 9dfc20902c

View file

@ -166,14 +166,16 @@ delete '/vm/:hostname' do
result = {} result = {}
result['ok'] = false
pools.each do |pool| pools.each do |pool|
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
end end
end end
result['ok'] = true
JSON.pretty_generate(result) JSON.pretty_generate(result)
end end