Skip to content

Commit

Permalink
chore: fix rubocop offenses
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardacoppo committed Dec 9, 2024
1 parent c249c2d commit d9bebde
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
5 changes: 3 additions & 2 deletions lib/syskit/cli/log_runtime_archive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions lib/syskit/cli/log_runtime_archive_main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand All @@ -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

Expand Down
6 changes: 3 additions & 3 deletions test/cli/test_log_runtime_archive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions test/cli/test_log_runtime_archive_main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit d9bebde

Please sign in to comment.