From 2456aeeff7b4acb536a4993488e77b2da67858bf Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Mon, 29 Jul 2024 18:38:59 +0200 Subject: [PATCH] L #6671: Linting ruby files --- src/datastore_mad/remotes/restic/increment_flatten | 6 +++--- src/datastore_mad/remotes/restic/monitor | 2 +- src/datastore_mad/remotes/restic/restic.rb | 7 +++++-- src/datastore_mad/remotes/restic/restore | 2 +- src/datastore_mad/remotes/restic/rm | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/datastore_mad/remotes/restic/increment_flatten b/src/datastore_mad/remotes/restic/increment_flatten index 4c06537f0f..a0047845f3 100755 --- a/src/datastore_mad/remotes/restic/increment_flatten +++ b/src/datastore_mad/remotes/restic/increment_flatten @@ -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(' ')}" diff --git a/src/datastore_mad/remotes/restic/monitor b/src/datastore_mad/remotes/restic/monitor index 067615535a..9609f626ef 100755 --- a/src/datastore_mad/remotes/restic/monitor +++ b/src/datastore_mad/remotes/restic/monitor @@ -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 diff --git a/src/datastore_mad/remotes/restic/restic.rb b/src/datastore_mad/remotes/restic/restic.rb index 6a067610f6..9d8e07bc42 100644 --- a/src/datastore_mad/remotes/restic/restic.rb +++ b/src/datastore_mad/remotes/restic/restic.rb @@ -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 diff --git a/src/datastore_mad/remotes/restic/restore b/src/datastore_mad/remotes/restic/restore index 87d974edd3..2c75510558 100755 --- a/src/datastore_mad/remotes/restic/restore +++ b/src/datastore_mad/remotes/restic/restore @@ -61,7 +61,7 @@ require 'opennebula/server_cipher_auth' require 'CommandManager' -require_relative './restic' +require_relative 'restic' require_relative '../../tm/lib/backup' # ------------------------------------------------------------------------------ diff --git a/src/datastore_mad/remotes/restic/rm b/src/datastore_mad/remotes/restic/rm index b92d88b355..1982a64c70 100755 --- a/src/datastore_mad/remotes/restic/rm +++ b/src/datastore_mad/remotes/restic/rm @@ -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