lib/kitchen/driver/ec2.rb in kitchen-ec2-3.7.1 vs lib/kitchen/driver/ec2.rb in kitchen-ec2-3.7.2

- old
+ new

@@ -1,6 +1,5 @@ -# -*- encoding: utf-8 -*- # # Author:: Fletcher Nichol (<fnichol@nichol.ca>) # # Copyright:: 2016-2018, Chef Software, Inc. # Copyright:: 2015-2018, Fletcher Nichol @@ -15,12 +14,12 @@ # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -require "benchmark" -require "json" +require "benchmark" unless defined?(Benchmark) +require "json" unless defined?(JSON) require "kitchen" require_relative "ec2_version" require_relative "aws/client" require_relative "aws/instance_generator" require_relative "aws/standard_platform" @@ -33,14 +32,14 @@ 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" +require "retryable" unless defined?(Retryable) +require "time" unless defined?(Time) +require "etc" unless defined?(Etc) +require "socket" unless defined?(Socket) module Kitchen module Driver @@ -259,10 +258,10 @@ fetch_windows_admin_password(server, state) end info("EC2 instance <#{state[:server_id]}> ready (hostname: #{state[:hostname]}).") instance.transport.connection(state).wait_until_ready - create_ec2_json(state) if instance.provisioner.name =~ /chef/i + create_ec2_json(state) if /chef/i.match?(instance.provisioner.name) debug("ec2:create '#{state[:hostname]}'") rescue Exception # Clean up any auto-created security groups or keys on the way out. delete_security_group(state) delete_key(state)