bug #341: catch exceptions creating OpenNebula::Client

This commit is contained in:
Javi Fontan committed 2010-09-09 16:23:13 +02:00
1 parent aff16e5051
commit 311eefcb35
5 files changed
+39 -7

No files matched your search

+7 -1
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(
+12 -2
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
+7 -1
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
+7 -2
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])
+6 -1
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])