diff --git a/Gemfile b/Gemfile index 1cae8a4..b060d5b 100644 --- a/Gemfile +++ b/Gemfile @@ -4,10 +4,13 @@ ruby File.read('.ruby-version').strip gem 'berkeley_library-docker', '~> 0.1.1' gem 'chronic', '~> 0.10.2' +gem 'logger' gem 'net-sftp' gem 'thor', '~> 1.1' group :test do + gem 'base64' + gem 'bigdecimal' gem 'colorize' gem 'rspec' gem 'rspec-its', '~> 1.3' diff --git a/Gemfile.lock b/Gemfile.lock index b64a6da..343fae7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -4,7 +4,9 @@ GEM addressable (2.9.0) public_suffix (>= 2.0.2, < 8.0) ast (2.4.3) + base64 (0.3.0) berkeley_library-docker (0.1.1) + bigdecimal (4.1.2) chronic (0.10.2) colorize (0.8.1) crack (0.4.5) @@ -14,9 +16,10 @@ GEM json (2.20.0) language_server-protocol (3.17.0.5) lint_roller (1.1.0) - net-sftp (3.0.0) - net-ssh (>= 5.0.0, < 7.0.0) - net-ssh (6.1.0) + logger (1.7.0) + net-sftp (4.0.0) + net-ssh (>= 5.0.0, < 8.0.0) + net-ssh (7.3.3) parallel (2.1.0) parser (3.3.11.1) ast (~> 2.4.1) @@ -79,9 +82,12 @@ PLATFORMS x86_64-linux DEPENDENCIES + base64 berkeley_library-docker (~> 0.1.1) + bigdecimal chronic (~> 0.10.2) colorize + logger net-sftp rspec rspec-its (~> 1.3) diff --git a/lib/berkeley_library/sftp_handler/downloader/gobi.rb b/lib/berkeley_library/sftp_handler/downloader/gobi.rb index d79e4e4..9317a9c 100644 --- a/lib/berkeley_library/sftp_handler/downloader/gobi.rb +++ b/lib/berkeley_library/sftp_handler/downloader/gobi.rb @@ -45,17 +45,6 @@ def default_host def default_username ENV.fetch('LIT_GOBI_USERNAME', nil) end - - def ssh_options - super.tap do |opts| - # @note As of 04/28/22, Gobi's server only supports outdated Diffie-Hellman - # key exchange algorithms, which you local sftp client will probably (and - # correctly) refuse. If you want to test manually, then for now you must - # explicitly allow the old algorithm by passing the following option to your - # sftp client: `-oKexAlgorithms=+diffie-hellman-group1-sha1`. - opts[:append_all_supported_algorithms] = true - end - end end end end diff --git a/spec/downloader/gobi_spec.rb b/spec/downloader/gobi_spec.rb index d2c9cd3..57daeaa 100644 --- a/spec/downloader/gobi_spec.rb +++ b/spec/downloader/gobi_spec.rb @@ -6,7 +6,7 @@ let(:now) { Time.new(2022, 5, 20, 0, 0, 0) } its(:default_host) { is_expected.to eq 'ftp.ybp.com' } - its(:ssh_options) { is_expected.to include(append_all_supported_algorithms: true) } + its(:ssh_options) { is_expected.not_to include(:append_all_supported_algorithms) } its(:default_filename) do Timecop.freeze(now) do diff --git a/spec/downloader/lbnl_spec.rb b/spec/downloader/lbnl_spec.rb index 2db32d3..b2d026f 100644 --- a/spec/downloader/lbnl_spec.rb +++ b/spec/downloader/lbnl_spec.rb @@ -5,6 +5,14 @@ # rubocop:disable Metrics/BlockLength describe BerkeleyLibrary::SftpHandler::Downloader::Lbnl do + around do |example| + old_lbnl_filename = ENV.fetch('LBNL_FILENAME', nil) + ENV['LBNL_FILENAME'] = 'test' + example.run + ensure + old_lbnl_filename.nil? ? ENV.delete('LBNL_FILENAME') : ENV['LBNL_FILENAME'] = old_lbnl_filename + end + its(:default_host) { is_expected.to eq 'ncc-1701.lbl.gov' } describe '#download!' do