From 1fe821d56d5b2ddaf92f961929775deffe6e18bd Mon Sep 17 00:00:00 2001 From: Clinton Wolfe Date: Fri, 18 Sep 2020 13:53:09 -0400 Subject: [PATCH] Chefstyle updates Signed-off-by: Clinton Wolfe --- kitchen-ec2.gemspec | 4 ++-- lib/kitchen/driver/aws/instance_generator.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/kitchen-ec2.gemspec b/kitchen-ec2.gemspec index 28cb6100..5704bc94 100644 --- a/kitchen-ec2.gemspec +++ b/kitchen-ec2.gemspec @@ -1,6 +1,6 @@ -lib = File.expand_path("../lib", __FILE__) +lib = File.expand_path("lib", __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require "kitchen/driver/ec2_version.rb" +require "kitchen/driver/ec2_version" Gem::Specification.new do |gem| gem.name = "kitchen-ec2" diff --git a/lib/kitchen/driver/aws/instance_generator.rb b/lib/kitchen/driver/aws/instance_generator.rb index 58c72464..2b6841a6 100644 --- a/lib/kitchen/driver/aws/instance_generator.rb +++ b/lib/kitchen/driver/aws/instance_generator.rb @@ -58,7 +58,7 @@ def ec2_instance_data # rubocop:disable Metrics/MethodLength, Metrics/AbcSize raise "The subnet tagged '#{config[:subnet_filter][:tag]}:#{config[:subnet_filter][:value]}' does not exist!" unless subnets.any? # => Select the least-populated subnet if we have multiple matches - subnet = subnets.sort_by { |s| s[:available_ip_address_count] }.last + subnet = subnets.max_by { |s| s[:available_ip_address_count] } vpc_id = subnet.vpc_id config[:subnet_id] = subnet.subnet_id end