1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-26 06:50:09 +03:00

feature #4240: Return service template info after clone action

This commit is contained in:
Daniel Molina 2016-01-22 17:50:57 +01:00
parent 8a05b49d59
commit 2ff5dfa1d9

View File

@ -512,9 +512,19 @@ post '/service_template/:id/action' do
status 204
service_template.rename(opts['name'])
when 'clone'
status 204
service_template.clone(opts['name'])
# TODO return id of the new template
rc = service_template.clone(opts['name'])
if OpenNebula.is_error?(rc)
error CloudServer::HTTP_ERROR_CODE[rc.errno], rc.message
end
new_stemplate = OpenNebula::ServiceTemplate.new_with_id(rc, @client)
new_stemplate.info
if OpenNebula.is_error?(new_stemplate)
error CloudServer::HTTP_ERROR_CODE[new_stemplate.errno], new_stemplate.message
end
status 201
body new_stemplate.to_json
else
OpenNebula::Error.new("Action #{action['perform']} not supported")
end