From 9e68ea91edbb475a72e24f1b8abcfae78e398186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Kr=C3=A1l?= Date: Sun, 3 Nov 2013 22:38:30 +0100 Subject: [PATCH] If we have sniffed no hosts, consider our sniff failed --- elasticsearch/transport.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/elasticsearch/transport.py b/elasticsearch/transport.py index 6fea4bdd..21c77ea2 100644 --- a/elasticsearch/transport.py +++ b/elasticsearch/transport.py @@ -174,6 +174,11 @@ class Transport(object): if host is not None: hosts.append(host) + # we weren't able to get any nodes, maybe using an incompatible + # transport_schema or host_info_callback blocked all - raise error. + if not hosts: + raise TransportError("Enable to sniff hosts - no viable hosts found.") + self.set_connections(hosts) def mark_dead(self, connection):