diff --git a/lib/syskit/cli/log_runtime_archive.rb b/lib/syskit/cli/log_runtime_archive.rb index e612d1b7..31cf387e 100644 --- a/lib/syskit/cli/log_runtime_archive.rb +++ b/lib/syskit/cli/log_runtime_archive.rb @@ -3,7 +3,7 @@ require "archive/tar/minitar" require "sys/filesystem" require "syskit/process_managers/remote/protocol" -require 'net/ftp' +require "net/ftp" module Syskit module CLI @@ -177,11 +177,12 @@ def self.connect_to_remote_server(server_params) ftp = Net::FTP.new ftp.connect(server_params[:interface], server_params[:port]) ftp.login(server_params[:user], server_params[:password]) + ftp.passive ftp end def self.disconnect_from_remote_server(ftp) - ftp.close if ftp + ftp&.close end # Find all dataset-looking folders within a root log folder diff --git a/lib/syskit/cli/log_runtime_archive_main.rb b/lib/syskit/cli/log_runtime_archive_main.rb index c8dff5b9..43e00838 100644 --- a/lib/syskit/cli/log_runtime_archive_main.rb +++ b/lib/syskit/cli/log_runtime_archive_main.rb @@ -109,7 +109,7 @@ def transfer_server( # rubocop:disable Metrics/ParameterLists ) end - no_commands do + no_commands do # rubocop:disable Metrics/BlockLength def validate_directory_exists(dir) dir = Pathname.new(dir) unless dir.directory? @@ -124,8 +124,9 @@ def make_archiver(root_dir, target_dir: nil) logger = Logger.new($stdout) Syskit::CLI::LogRuntimeArchive.new( - root_dir, target_dir: target_dir, - logger: logger, max_archive_size: options[:max_size] * (1024**2) + root_dir, + target_dir: target_dir, logger: logger, + max_archive_size: options[:max_size] * (1024**2) ) end diff --git a/test/cli/test_log_runtime_archive.rb b/test/cli/test_log_runtime_archive.rb index b268b7f8..86e6ddb5 100644 --- a/test/cli/test_log_runtime_archive.rb +++ b/test/cli/test_log_runtime_archive.rb @@ -534,7 +534,7 @@ def should_archive_dataset(dataset, archive_basename, full:) it "transfers datasets" do ftp = connect_to_server - + datasets = [ make_valid_folder("20220434-2023"), make_valid_folder("20220434-2024"), @@ -554,8 +554,8 @@ def create_server thread = Thread.new do server = RobyApp::LogTransferServer::SpawnServer.new( @target_dir, @params[:user], @params[:password], - @params[:certfile_path], interface: @params[:interface], - port: @params[:port] + @params[:certfile_path], + interface: @params[:interface], port: @params[:port] ) server.run end diff --git a/test/cli/test_log_runtime_archive_main.rb b/test/cli/test_log_runtime_archive_main.rb index 6d937525..883ba911 100644 --- a/test/cli/test_log_runtime_archive_main.rb +++ b/test/cli/test_log_runtime_archive_main.rb @@ -144,7 +144,7 @@ def call_archive(root_path, archive_path, low_limit, freed_limit) certfile_path: ca.private_certificate_path, interface: interface, port: port } - server = spawn_server + spawn_server end it "calls transfer with the specified period" do @@ -167,7 +167,6 @@ def call_archive(root_path, archive_path, low_limit, freed_limit) *@server_params.values, "--period", 0.5 ] - pp "***", args LogRuntimeArchiveMain.start(args) end