Standardize 'running' dashboard API output

This commit is contained in:
Scott Schneider 2014-02-11 14:05:31 -08:00
parent c8988c3dbf
commit 0fccb48455
2 changed files with 14 additions and 7 deletions

View file

@ -115,10 +115,11 @@ get '/dashboard/stats/vcloud/running' do
config[:pools].each do |pool|
running = $redis.scard( 'vmware_host_pool__running__' + pool['name'] )
pool['major'] = $1 if pool['name'] =~ /^(\w+)\-/
result[pool['major']] = result[pool['major']].to_i + running.to_i
result[pool['major']] ||= Hash.new
result[pool['major']]['running'] = result[pool['major']]['running'].to_i + running.to_i
end
content_type :json