mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
Removing unnecessary 'folder' and 'pool' params
This commit is contained in:
parent
b05311193f
commit
314a2cb659
1 changed files with 9 additions and 13 deletions
|
|
@ -142,24 +142,20 @@ post '/vm/:template' do
|
||||||
result = {}
|
result = {}
|
||||||
result[params[:template]] = {}
|
result[params[:template]] = {}
|
||||||
|
|
||||||
if ( ( ! params[:folder] ) or ( ! params[:pool] ))
|
if ( $redis.scard('vmware_host_pool__ready__'+params[:template]) > 0 )
|
||||||
result[params[:template]]['error'] = 'You must specify a destination \'folder\' and \'pool\''
|
vm = $redis.spop('vmware_host_pool__ready__'+params[:template])
|
||||||
else
|
|
||||||
if ( $redis.scard('vmware_host_pool__ready__'+params[:template]) > 0 )
|
|
||||||
vm = $redis.spop('vmware_host_pool__ready__'+params[:template])
|
|
||||||
|
|
||||||
unless (vm.nil?)
|
unless (vm.nil?)
|
||||||
$redis.sadd('vmware_host_pool__running__'+params[:template], vm)
|
$redis.sadd('vmware_host_pool__running__'+params[:template], vm)
|
||||||
$redis.hset('vmware_host_pool__active__'+params[:template], vm, Time.now)
|
$redis.hset('vmware_host_pool__active__'+params[:template], vm, Time.now)
|
||||||
|
|
||||||
result[params[:template]]['ok'] = true
|
result[params[:template]]['ok'] = true
|
||||||
result[params[:template]]['hostname'] = vm
|
result[params[:template]]['hostname'] = vm
|
||||||
else
|
|
||||||
result[params[:template]]['ok'] = false
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
result[params[:template]]['ok'] = false
|
result[params[:template]]['ok'] = false
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
result[params[:template]]['ok'] = false
|
||||||
end
|
end
|
||||||
|
|
||||||
JSON.pretty_generate(result)
|
JSON.pretty_generate(result)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue