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

bug #341: catch exceptions creating OpenNebula::Client

This commit is contained in:
Javi Fontan 2010-09-09 16:22:57 +02:00
parent aff16e5051
commit 311eefcb35
5 changed files with 39 additions and 7 deletions

View File

@ -36,7 +36,13 @@ if !(vm_id=ARGV[0])
end
client = Client.new()
begin
client = Client.new()
rescue Exception => e
puts "Error: #{e}"
exit(-1)
end
img_repo = ImageRepository.new
vm = VirtualMachine.new(

View File

@ -84,7 +84,12 @@ class AuthorizationManager < OpenNebulaDriver
end
def action_authorize(request_id, user_id, *tokens)
auth=@permissions.auth(user_id, tokens.flatten)
begin
auth=@permissions.auth(user_id, tokens.flatten)
rescue Exception => e
auth="Error: #{e}"
end
if auth==true
send_message('AUTHORIZE', RESULT[:success],
request_id, 'success')
@ -95,7 +100,12 @@ class AuthorizationManager < OpenNebulaDriver
end
end
begin
am=AuthorizationManager.new
rescue Exception => e
puts "Error: #{e}"
exit(-1)
end
am=AuthorizationManager.new
am.start_driver

View File

@ -91,7 +91,13 @@ when "quota"
when 'set'
check_parameters("quota set", 3)
Dir.chdir VAR_LOCATION
add_quota(*ARGV[1..3])
begin
add_quota(*ARGV[1..3])
rescue Exception => e
puts "Error starting server: #{e}"
exit(-1)
end
else
#default
end

View File

@ -45,8 +45,13 @@ require 'EC2QueryServer'
include OpenNebula
$econe_server = EC2QueryServer.new(CONFIGURATION_FILE,
TEMPLATE_LOCATION, VIEWS_LOCATION)
begin
$econe_server = EC2QueryServer.new(CONFIGURATION_FILE,
TEMPLATE_LOCATION, VIEWS_LOCATION)
rescue Exception => e
puts "Error starting server: #{e}"
exit(-1)
end
if CloudServer.is_port_open?($econe_server.config[:server],
$econe_server.config[:port])

View File

@ -49,7 +49,12 @@ require 'OpenNebula'
include OpenNebula
$occi_server = OCCIServer.new(CONFIGURATION_FILE, TEMPLATE_LOCATION)
begin
$occi_server = OCCIServer.new(CONFIGURATION_FILE, TEMPLATE_LOCATION)
rescue Exception => e
puts "Error starting server: #{e}"
exit(-1)
end
if CloudServer.is_port_open?($occi_server.config[:server],
$occi_server.config[:port])