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

L #6671: Linting ruby files

This commit is contained in:
Ruben S. Montero 2024-07-29 18:38:59 +02:00
parent 48060269f1
commit 2456aeeff7
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87
5 changed files with 11 additions and 8 deletions

View File

@ -56,7 +56,7 @@ require 'date'
require_relative '../../tm/lib/backup'
require_relative '../../tm/lib/tm_action'
require_relative './restic'
require_relative 'restic'
daction64 = STDIN.read
@ -100,11 +100,11 @@ def flatten_chains(rds, image, paths, snapshot)
# Gather and quote all file paths to be included in the snapshot.
snap = snapshot['short_id']
to_backup = paths[:disks][:by_snap][snap] + paths[:other][:uniq]
to_backup_quoted = to_backup.map {|p| "'#{p.delete(%["'])}'" }
to_backup_quoted = to_backup.map {|p| "'#{p.delete(%("'))}'" }
# Gather and quote all file paths to be deleted after.
to_delete = paths[:disks][:uniq] + paths[:other][:uniq]
to_delete_quoted = to_delete.map {|p| "'#{p.delete(%["'])}'" }
to_delete_quoted = to_delete.map {|p| "'#{p.delete(%("'))}'" }
rm_cmd = to_delete_quoted.empty? ? '' : "rm -f #{to_delete_quoted.join(' ')}"

View File

@ -113,7 +113,7 @@ begin
sync_manager.update_remotes "#{sftp_user}@#{sftp_server}",
nil,
:rsync,
%w[VERSION datastore/restic/restic]
['VERSION', 'datastore/restic/restic']
end
rescue StandardError => e
STDERR.puts e.full_message

View File

@ -161,7 +161,7 @@ class Restic
def resticenv_rb(restic_bin = @restic_bin)
ENV['RESTIC_BIN'] = restic_bin
ENV['RESTIC_PASSWORD'] = @passwd
ENV['GOMAXPROCS'] = "#{@maxproc}" unless @maxproc == -1
ENV['GOMAXPROCS'] = @maxproc.to_s unless @maxproc == -1
end
def [](xpath)
@ -426,8 +426,11 @@ class Restic
disk_paths.each do |path|
wdir = File.dirname(path) if wdir.nil?
file = File.basename(path)
rcmd = restic("dump '#{snap}' '#{path}'", 'quiet' => nil)
script << "install -d '#{wdir}/'"
script << "#{restic("dump '#{snap}' '#{path}'", 'quiet' => nil)} > '#{wdir}/#{file}'"
script << "#{rcmd} > '#{wdir}/#{file}'"
end
end

View File

@ -61,7 +61,7 @@ require 'opennebula/server_cipher_auth'
require 'CommandManager'
require_relative './restic'
require_relative 'restic'
require_relative '../../tm/lib/backup'
# ------------------------------------------------------------------------------

View File

@ -54,7 +54,7 @@ $LOAD_PATH << RUBY_LIB_LOCATION
require 'base64'
require_relative '../../tm/lib/backup'
require_relative './restic'
require_relative 'restic'
daction64 = STDIN.read