1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

F #5422: Improve error handling in onevcenter

for better FireEdge integration
This commit is contained in:
Tino Vazquez 2021-09-10 13:56:02 +02:00
parent 190b0c6e4f
commit 62f3ae3272
No known key found for this signature in database
GPG Key ID: 14201E424D02047E
2 changed files with 16 additions and 6 deletions

View File

@ -178,7 +178,8 @@ CommandParser::CmdParser.new(ARGV) do
helper.list_object(options, list)
rescue StandardError => e
puts e.message
STDERR.puts e.message
exit 1
end
exit 0
@ -209,7 +210,8 @@ CommandParser::CmdParser.new(ARGV) do
helper.list_object(options, list)
rescue StandardError => e
puts e.message
STDERR.puts e.message
exit 1
end
exit 0
@ -256,7 +258,8 @@ CommandParser::CmdParser.new(ARGV) do
importer.stdout
rescue StandardError => e
puts e.message
STDERR.puts e.message
exit 1
end
exit 0
@ -283,7 +286,8 @@ CommandParser::CmdParser.new(ARGV) do
importer.stdout
rescue StandardError => e
puts e.message
STDERR.puts e.message
exit 1
end
exit 0
@ -305,7 +309,11 @@ CommandParser::CmdParser.new(ARGV) do
:options => [VCENTER, USER, PASS, USE_DEFAULTS, PORT] do
con_ops = helper.connection_options('Hosts', options)
VCenterDriver::VcImporter.import_clusters(con_ops, options)
begin
VCenterDriver::VcImporter.import_clusters(con_ops, options)
rescue StandardError => e
exit 1
end
exit 0
end

View File

@ -369,9 +369,11 @@ module VCenterDriver
error_msg = "\nError: #{e.message}\n"
error_msg << "#{e.backtrace}\n" \
if VCenterDriver::CONFIG[:debug_information]
STDOUT.puts error_msg
STDERR.puts error_msg
raise_error = true
ensure
vi_client.close_connection if vi_client
raise if raise_error
end
end