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

M #-: fix S3 download in vCenter DS (#252)

Co-authored-by: Tino Vázquez <cvazquez@opennebula.io>
This commit is contained in:
Alejandro Huertas Herrero 2020-09-28 14:05:45 +02:00 committed by GitHub
parent e579b913f7
commit e43e625032
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 11 deletions

View File

@ -106,8 +106,9 @@ if VCenterDriver::FileHelper.remote_or_needs_unpack?(img_path)
downsh_args << '--convert vmdk'
downloader = "#{File.dirname(__FILE__)}/../downloader.sh #{downsh_args}"
b64 = Base64.encode64(drv_action.to_xml).gsub!("\n", '')
rc = system("#{downloader} #{img_path} #{temp_file}")
rc = system("DRV_ACTION=#{b64} #{downloader} #{img_path} #{temp_file}")
if there_is_not_system_error?(rc)
STDERR.puts "Error downloading #{img_path}"
@ -171,17 +172,17 @@ files_to_upload.each_with_index do |f, index|
cmd = "#{File.dirname(__FILE__)}/../vcenter_uploader.rb #{uploader_args}"
stdout_str, status = Open3.capture2(cmd)
if last_file_to_upload?(index, files_to_upload)
puts "%s %s" % [stdout_str, "vmdk"]
target, stderr, status = Open3.capture3(cmd)
if !status.success?
STDERR.puts "Cannot upload file #{f}: #{stderr}"
FileUtils.rm_rf(temp_file) if temp_file
exit(-1)
end
next if status.success?
STDERR.puts "Cannot upload file #{f}"
FileUtils.rm_rf(temp_file) if temp_file
exit(-1)
if last_file_to_upload?(index, files_to_upload)
puts "#{target.gsub("\n", '')} vmdk"
end
end
FileUtils.rm_rf(temp_file) if temp_file

View File

@ -65,7 +65,7 @@ module VCenterDriver
end
def self.remote?(file)
file.match(%r{^https?://})
file.match(%r{^https?://}) || file.match(%r{^s3?://})
end
def self.vmdk?(file)