Skip to content

Commit

Permalink
Require Ruby 2.3 and aws-sdk-ec2
Browse files Browse the repository at this point in the history
Stop depending on the monolithic AWS sdk when we only need the ec2 SDK, which is tiny in comparison.

Signed-off-by: Tim Smith <[email protected]>
  • Loading branch information
tas50 committed Mar 15, 2019
1 parent 09ed003 commit 4434dc6
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 11 deletions.
4 changes: 2 additions & 2 deletions kitchen-ec2.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ Gem::Specification.new do |gem|
gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR).grep(/LICENSE|^lib/)
gem.require_paths = ["lib"]

gem.required_ruby_version = ">= 2.2.2"
gem.required_ruby_version = ">= 2.3"

gem.add_dependency "test-kitchen", ">= 1.4.1", "< 3"
gem.add_dependency "excon"
gem.add_dependency "multi_json"
gem.add_dependency "aws-sdk", "~> 2"
gem.add_dependency "aws-sdk-ec2", "~> 1.0"
gem.add_dependency "retryable", "~> 2.0"

gem.add_development_dependency "rspec", "~> 3.2"
Expand Down
2 changes: 1 addition & 1 deletion lib/kitchen/driver/aws/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

require "aws-sdk"
require "aws-sdk-ec2"
require "aws-sdk-core/credentials"
require "aws-sdk-core/shared_credentials"
require "aws-sdk-core/instance_profile_credentials"
Expand Down
2 changes: 1 addition & 1 deletion lib/kitchen/driver/aws/instance_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# limitations under the License.

require "base64"
require "aws-sdk"
require "aws-sdk-ec2"

module Kitchen

Expand Down
6 changes: 1 addition & 5 deletions lib/kitchen/driver/ec2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,13 @@
require_relative "aws/standard_platform/freebsd"
require_relative "aws/standard_platform/ubuntu"
require_relative "aws/standard_platform/windows"
require "aws-sdk-ec2"
require "aws-sdk-core/waiters/errors"
require "retryable"
require "time"
require "etc"
require "socket"

Aws.eager_autoload!

module Kitchen

module Driver
Expand Down Expand Up @@ -96,9 +95,6 @@ class Ec2 < Kitchen::Driver::Base

def initialize(*args, &block)
super
# AWS Ruby SDK loading isn't thread safe, so as soon as we know we're
# going to use EC2, autoload it. Seems to have been fixed in Ruby 2.3+
::Aws.eager_autoload! unless RUBY_VERSION.to_f >= 2.3
end

def self.validation_warn(driver, old_key, new_key)
Expand Down
2 changes: 1 addition & 1 deletion spec/kitchen/driver/aws/instance_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
require "kitchen/driver/aws/client"
require "tempfile"
require "base64"
require "aws-sdk"
require "aws-sdk-ec2"

describe Kitchen::Driver::Aws::InstanceGenerator do

Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,6 @@

end

require "aws-sdk"
require "aws-sdk-ec2"
# https://ruby.awsblog.com/post/Tx15V81MLPR8D73/Client-Response-Stubs
Aws.config[:stub_responses] = true

0 comments on commit 4434dc6

Please sign in to comment.