(QENG-2995) Display associated VMs in GET /token/:token endpoint

This commit is contained in:
Scott Schneider 2015-11-04 12:35:35 -08:00
parent 12da1e07d2
commit e0356968df
3 changed files with 33 additions and 8 deletions

View file

@ -209,6 +209,17 @@ module Vmpooler
if not token.nil? and not token.empty?
status 200
pools.each do |pool|
backend.smembers('vmpooler__running__' + pool['name']).each do |vm|
if backend.hget('vmpooler__vm__' + vm, 'token:token') == params[:token]
token['vms'] ||= {}
token['vms']['running'] ||= []
token['vms']['running'].push(vm)
end
end
end
result = { 'ok' => true, params[:token] => token }
else
status 404