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

M #-: fix minor bug in S3 upload (#264)

This commit is contained in:
Alejandro Huertas Herrero 2020-09-29 14:08:01 +02:00 committed by GitHub
parent f13f3365fc
commit 313b74e651
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View File

@ -173,7 +173,7 @@ files_to_upload.each_with_index do |f, index|
cmd = "#{File.dirname(__FILE__)}/../vcenter_uploader.rb #{uploader_args}"
target, stderr, status = Open3.capture3(cmd)
if !status.success?
STDERR.puts "Cannot upload file #{f}: #{stderr}"
FileUtils.rm_rf(temp_file) if temp_file

View File

@ -111,10 +111,17 @@ end
cmd = "#{UTILS_PATH}/downloader.sh #{import_source} -"
Open3.popen3(cmd) do |_, o, _, _|
Open3.popen3(cmd) do |_, o, e, _|
body = o.read(read_length)
if o.eof?
error = Thread.new { e.read }.value
unless error.empty?
STDERR.puts error
exit 1
end
s3.put_object(body)
else
s3.create_multipart_upload

View File

@ -197,7 +197,7 @@ module VCenterDriver
.dirname(
descriptor_url.host+descriptor_url.path
)
next unless ds.descriptor?(image_path + '/' + file_to_download)
next unless ds.is_descriptor?(image_path + '/' + file_to_download)
files_to_download <<
download_all_filenames_in_descriptor(
@ -223,7 +223,7 @@ module VCenterDriver
# related files, creates a tar.gz and dumps it in stdout
def self.dump_vmdk_tar_gz(vcenter_url, ds)
image_source = vcenter_url.host + vcenter_url.path
if ds.descriptor?(image_source)
if ds.is_descriptor?(image_source)
files_to_download =
get_all_filenames_in_descriptor(
vcenter_url,