lib/kitchen/driver/ec2.rb in kitchen-ec2-3.8.0 vs lib/kitchen/driver/ec2.rb in kitchen-ec2-3.9.0
- old
+ new
@@ -54,11 +54,12 @@
default_config :region, ENV["AWS_REGION"] || "us-east-1"
default_config :shared_credentials_profile, ENV["AWS_PROFILE"]
default_config :availability_zone, nil
default_config :instance_type, &:default_instance_type
- default_config :ebs_optimized, false
+ default_config :ebs_optimized, false
+ default_config :delete_on_termination, true
default_config :security_group_ids, nil
default_config :security_group_filter, nil
default_config :security_group_cidr_ip, "0.0.0.0/0"
default_config :tags, "created-by" => "test-kitchen"
default_config :user_data do |driver|
@@ -316,21 +317,18 @@
@image
end
def default_instance_type
- @instance_type ||= begin
- # We default to the free tier (t2.micro for hvm, t1.micro for paravirtual)
- if image && image.virtualization_type == "hvm"
- info("instance_type not specified. Using free tier t2.micro instance ...")
- "t2.micro"
- else
- info("instance_type not specified. Using free tier t1.micro instance since" \
- " image is paravirtual (pick an hvm image to use the superior t2.micro!) ...")
- "t1.micro"
- end
- end
+ @instance_type ||= if image && image.virtualization_type == "hvm"
+ info("instance_type not specified. Using free tier t2.micro instance ...")
+ "t2.micro"
+ else
+ info("instance_type not specified. Using free tier t1.micro instance since" \
+ " image is paravirtual (pick an hvm image to use the superior t2.micro!) ...")
+ "t1.micro"
+ end
end
# The actual platform is the platform detected from the image
def actual_platform
@actual_platform ||= Aws::StandardPlatform.from_image(self, image) if image
@@ -457,15 +455,13 @@
expanded = []
end
errs = []
configs.each do |conf|
- begin
- @config = conf
- return submit_spot
- rescue => e
- errs.append(e)
- end
+ @config = conf
+ return submit_spot
+ rescue => e
+ errs.append(e)
end
raise ["Could not create a spot instance:", errs].flatten.join("\n")
end
def submit_spot