mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
Fix upload error in SunstoneServer
This commit is contained in:
parent
01b34c8eb4
commit
6fd81e8668
@ -27,7 +27,7 @@ module OpenNebulaJSON
|
||||
end
|
||||
end
|
||||
|
||||
def parse_json(json_str, root_element)
|
||||
def self.parse_json(json_str, root_element)
|
||||
begin
|
||||
hash = JSON.parse(json_str)
|
||||
rescue Exception => e
|
||||
@ -41,6 +41,10 @@ module OpenNebulaJSON
|
||||
end
|
||||
end
|
||||
|
||||
def parse_json(json_str, root_element)
|
||||
JSONUtils.parse_json(json_str, root_element)
|
||||
end
|
||||
|
||||
def parse_json_sym(json_str, root_element)
|
||||
begin
|
||||
parser = JSON.parser.new(json_str, {:symbolize_names => true})
|
||||
|
@ -136,14 +136,14 @@ class SunstoneServer < CloudServer
|
||||
#
|
||||
############################################################################
|
||||
def upload(template, file_path)
|
||||
image_hash = parse_json(template, 'image')
|
||||
image_hash = JSONUtils.parse_json(template, 'image')
|
||||
if OpenNebula.is_error?(image_hash)
|
||||
return [500, image_hash.to_json]
|
||||
end
|
||||
|
||||
image_hash['PATH'] = file_path
|
||||
|
||||
ds_id = parse_json(template, 'ds_id')
|
||||
ds_id = JSONUtils.parse_json(template, 'ds_id')
|
||||
if OpenNebula.is_error?(ds_id)
|
||||
return [500, ds_id.to_json]
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user