lib/kitchen/driver/ec2.rb in kitchen-ec2-3.12.0 vs lib/kitchen/driver/ec2.rb in kitchen-ec2-3.13.0
- old
+ new
@@ -249,18 +249,10 @@
on: ::Aws::EC2::Errors::InvalidInstanceIDNotFound
) do |r, _|
wait_until_ready(server, state)
end
- if windows_os? &&
- instance.transport[:username] =~ /administrator/i &&
- instance.transport[:password].nil?
- # If we're logging into the administrator user and a password isn't
- # supplied, try to fetch it from the AWS instance
- fetch_windows_admin_password(server, state)
- end
-
info("EC2 instance <#{state[:server_id]}> ready (hostname: #{state[:hostname]}).")
instance.transport.connection(state).wait_until_ready
attach_network_interface(state) unless config[:elastic_network_interface_id].nil?
create_ec2_json(state) if /chef/i.match?(instance.provisioner.name)
debug("ec2:create '#{state[:hostname]}'")
@@ -534,15 +526,22 @@
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}"
+ if instance.transport[:username] =~ /administrator/i &&
+ instance.transport[:password].nil?
+ # If we're logging into the administrator user and a password isn't
+ # supplied, try to fetch it from the AWS instance
+ fetch_windows_admin_password(server, state)
+ else
+ output = server.console_output.output
+ unless output.nil?
+ output = Base64.decode64(output)
+ debug "Console output: --- \n#{output}"
+ end
+ ready = !!(output =~ /Windows is Ready to use/)
end
- ready = !!(output =~ /Windows is Ready to use/)
end
ready
end
end