Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
12 changes: 9 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
11 changes: 0 additions & 11 deletions lib/berkeley_library/sftp_handler/downloader/gobi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fantastic!

end
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/downloader/gobi_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions spec/downloader/lbnl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this will make future testing easier (as I always had to remember to set that environment variable locally).

its(:default_host) { is_expected.to eq 'ncc-1701.lbl.gov' }

describe '#download!' do
Expand Down
Loading