mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
(QENG-2995) Display associated VMs in GET /token/:token endpoint
This commit is contained in:
parent
12da1e07d2
commit
e0356968df
3 changed files with 33 additions and 8 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue