mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
Allow a PUT to modify running VMs
This commit is contained in:
parent
b52807f9f6
commit
036e9d93fc
1 changed files with 22 additions and 0 deletions
|
|
@ -305,6 +305,28 @@ module Vmpooler
|
|||
|
||||
JSON.pretty_generate(result)
|
||||
end
|
||||
|
||||
put '/vm/:hostname/?' do
|
||||
content_type :json
|
||||
|
||||
result = {}
|
||||
|
||||
result['ok'] = false
|
||||
|
||||
if $redis.exists('vmpooler__vm__'+params[:hostname])
|
||||
jdata = JSON.parse(request.body.read)
|
||||
|
||||
jdata.each do |param, arg|
|
||||
case param
|
||||
when 'lifetime'
|
||||
$redis.hset('vmpooler__vm__'+params[:hostname], param, arg)
|
||||
result['ok'] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
JSON.pretty_generate(result)
|
||||
end
|
||||
}
|
||||
|
||||
my_app.run!
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue