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

L #-: Linting for rsync driver

This commit is contained in:
Tino Vázquez 2022-12-12 11:10:25 +01:00
parent 8e9f48d44d
commit 6aab99ec2e
No known key found for this signature in database
GPG Key ID: 14201E424D02047E
3 changed files with 6 additions and 8 deletions

View File

@ -85,7 +85,7 @@ end
path = Pathname.new(base).cleanpath.to_s
backup_id = "#{SecureRandom.hex[0, 6]}"
backup_id = SecureRandom.hex[0, 6].to_s
backup_path = "#{path}/#{vmid}/#{backup_id}/"
#-------------------------------------------------------------------------------

View File

@ -85,7 +85,7 @@ begin
rsync_host = rds.elements['DATASTORE/TEMPLATE/RSYNC_HOST'].text
rsync_user = rds.elements['DATASTORE/TEMPLATE/RSYNC_USER'].text
vm_id = rds.elements['IMAGE/VMS[1]/ID'].text.to_i
image = TransferManager::BackupImage.new(drv_action)
image = TransferManager::BackupImage.new(drv_action)
rescue StandardError => e
STDERR.puts "Missing datastore or image attributes: #{e.message}"
exit(1)
@ -177,7 +177,6 @@ br_disks = restorer.disk_images(disks)
one_error = ''
images = []
# Create disk images
br_disks.each do |_id, disk|
# Fix image name - maybe not necessary any longer

View File

@ -68,7 +68,7 @@ _ds_id = ARGV[1]
# base path = /var/lib/one//datastores/100/13
begin
rds = REXML::Document.new(Base64::decode64(daction64)).root.elements
rds = REXML::Document.new(Base64.decode64(daction64)).root.elements
img = rds['/DS_DRIVER_ACTION_DATA/IMAGE/PATH'].text
rsync_host = rds['/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/RSYNC_HOST'].text
rsync_user = rds['/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/RSYNC_USER'].text
@ -88,9 +88,8 @@ begin
last_snap = parts[1].split(',')[-1].split(':')[-1]
cmd = "cat #{base_path}#{last_snap}/vm.xml"
rescue StandardError => se
STDERR.puts se.message
rescue StandardError => e
STDERR.puts e.message
exit(1)
end
@ -106,7 +105,7 @@ if rc.code != 0
exit(1)
end
vm = REXML::Document.new(Base64::decode64(rc.stdout)).root
vm = REXML::Document.new(Base64.decode64(rc.stdout)).root
xpath = "/VM/TEMPLATE/DISK[ DISK_ID = #{diskid[1]} ]/SIZE"