lib/kitchen/driver/ec2.rb in kitchen-ec2-2.4.0 vs lib/kitchen/driver/ec2.rb in kitchen-ec2-2.5.0

- old
+ new

@@ -61,10 +61,11 @@ driver.default_instance_type end default_config :ebs_optimized, false 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| if driver.windows_os? driver.default_windows_user_data end @@ -511,10 +512,15 @@ state[:hostname] = hostname # Euca instances often report ready before they have an IP ready = aws_instance.exists? && aws_instance.state.name == "running" && hostname != "0.0.0.0" + + if ready && ( hostname.nil? || hostname == "" ) + debug("Unable to detect hostname using interface_type #{config[:interface]}. Fallback to ordered mapping") + state[:hostname] = hostname(aws_instance, nil) + end if ready && windows_os? output = server.console_output.output unless output.nil? output = Base64.decode64(output) debug "Console output: --- \n#{output}" @@ -757,10 +763,10 @@ ip_permissions: [22, 3389, 5985, 5986].map do |port| { ip_protocol: "tcp", from_port: port, to_port: port, - ip_ranges: [{ cidr_ip: "0.0.0.0/0" }], + ip_ranges: [{ cidr_ip: config[:security_group_cidr_ip] }], } end ) end