lib/kitchen/driver/ec2.rb in kitchen-ec2-3.3.0 vs lib/kitchen/driver/ec2.rb in kitchen-ec2-3.4.0

- old
+ new

@@ -289,10 +289,14 @@ def destroy(state) if state[:server_id] server = ec2.get_instance(state[:server_id]) unless server.nil? instance.transport.connection(state).close - server.terminate + begin + server.terminate + rescue ::Aws::EC2::Errors::InvalidInstanceIDNotFound => e + warn("Received #{e}, instance was probably already destroyed. Ignoring") + end end if state[:spot_request_id] debug("Deleting spot request <#{state[:server_id]}>") ec2.client.cancel_spot_instance_requests( spot_instance_request_ids: [state[:spot_request_id]]