1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

F #664: Fix import vm when name exists (#934)

This commit is contained in:
Sergio Betanzos 2021-03-10 13:47:55 +01:00 committed by GitHub
parent 0fb1207156
commit ed67b0bc2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,7 +72,7 @@ module OpenNebulaJSON
def app_vm_import(params=Hash.new)
template = Template.new_with_id(params['ORIGIN_ID'], @client)
rc = template.info
return rc if OpenNebula.is_error?(rc)
template.extend(TemplateExt)
@ -80,14 +80,12 @@ module OpenNebulaJSON
market_id = params['MARKETPLACE_ID'].to_i
import_all = params['IMPORT_ALL']
template_name = params['NAME']
rc = template.mp_import(market_id, import_all, template_name)
if OpenNebula.is_error?(rc)
return OpenNebula::Error.new(rc[0])
end
rc, ids = template.mp_import(market_id, import_all, template_name)
return rc
return [rc.message, ids] if OpenNebula.is_error?(rc)
rc
end
def app_service_import(params=Hash.new)
@ -100,7 +98,7 @@ module OpenNebulaJSON
return rc if OpenNebula.is_error?(rc)
s_template.extend(ServiceTemplateExt)
vm_templates_ids = s_template.vm_template_ids
templates = {}
@ -136,7 +134,7 @@ module OpenNebulaJSON
ids_images.append(ids)
end
end
market_id = params['MARKETPLACE_ID'].to_i
template_name = params['NAME']
@ -146,7 +144,7 @@ module OpenNebulaJSON
if (params['IMPORT_ALL'] == 'yes')
ids_images.each do |id|
app = MarketPlaceApp.new_with_id(id, @client)
app.info
app.delete